我试图通过从 Java 连接到 Oracle DB 来执行 SELECT 语句。其中一个表有 Timestamp 数据类型的列。当我运行 jUnit 测试时,我得到了以下异常
java.lang.ClassCastException: oracle.sql.TIMESTAMP cannot be cast to java.sql.Timestamp
at com.sun.rowset.CachedRowSetImpl.getTimestamp(Unknown Source)
at org.springframework.jdbc.support.rowset.ResultSetWrappingSqlRowSet.getTimestamp(ResultSetWrappingSqlRowSet.java:491)
at com.wellpoint.provider.rnr.biz.integration.dao.PropsDAO.buildPropsResponse(PropsDAO.java:1476)
at com.wellpoint.provider.rnr.biz.integration.dao.PropsDAO.populatProps(PropsDAO.java:1320)
at com.wellpoint.provider.rnr.biz.integration.dao.PropsDAO.getProps(PropsDAO.java:388)
at com.wellpoint.provider.rnr.biz.managers.PropsManager.getProps(PropsManager.java:95)
at com.wellpoint.provider.rnr.biz.managers.PropsTest.testGetProps(PropsTest.java:94)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
...... .....
在参数VM选项卡中为PropsTest.java设置-D oracle.jdbc.J2EE13Compliant=true,尝试执行并得到以下
java.lang.NoClassDefFoundError: oracle/jdbc/J2EE13Compliant=true
Caused by: java.lang.ClassNotFoundException: oracle.jdbc.J2EE13Compliant=true
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Exception in thread "main"
我错过了添加任何罐子还是必须遵循其他方法来解决这个问题?
您的任何帮助都将受到重视!
谢谢!