当连接oracle出现这种错误的时候:

a.sql.SQLException: Listener refused the connection with the following error:

ORA-12519, TNS:no appropriate service handler found
The Connection descriptor used by the client was:
127.0.0.1:1521:orcl
 
不是代码写错了。
而是数据库连接没有关,记得在写完之后关闭Connection,Statement,以及ResultSet。