请问如何得到Oracle SQLException的errorCode, 用SQLException.getErrorcode() 总是返回0例如有如下Oracle Exception:
org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
pacwas1:1521:testdb
); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
xxx:1521:xxx
))当Catch到这个SQLException并且使用getErrorcode() 总是返回0,但我期待的是ORA-12505,请问有好的方法吗?
org.jboss.util.NestedSQLException: Could not create connection; - nested throwable: (java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
pacwas1:1521:testdb
); - nested throwable: (org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
xxx:1521:xxx
))当Catch到这个SQLException并且使用getErrorcode() 总是返回0,但我期待的是ORA-12505,请问有好的方法吗?
解决方案 »
- 触发器问题:在往一个table新增一笔资料后,同时往另外一个table新增一笔资料
- oracle 存储过程编译报错!请各位高数帮忙看看,小弟在线等待...
- 题目:有一个两维表,M行N列,请用Oracle的存储过程,转置成N行M列
- 如何删除列
- 虚拟机上AS3下安装oracle9i的问题
- 请教各路神仙Oracle中有没有类似sign的函数,与sign不同的对于非正数统统返回0?
- oracle基本的问题
- 这样的外联接oracle8i中怎样实现呢?
- Oracle跑一段时间就非常慢,什么原因
- oracle中使用sql语句查询 报表工具使用的是finereport
- 重复记录保留一条的初级问题
- 两个UPDATE语句 哪个效率高?
catch(SQLException e) {System.out.println(e.getMessage);}
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
要只得到ORA-12505的话,就再自己截字符串的前9位吧