我尝试将我的rest应用程序连接到DB2数据库。我使用Tomcat 9来测试我的应用程序 重要:我在虚拟机中工作。 我使用jndi配置设置了context.xml:
context.xml中
<Resource name="jdbc/reeval" type="javax.sql.DataSource"
auth="Container" username="XXX" password="XXX"
driverClassName="com.ibm.db2.jcc.DB2Driver"
url="jdbc:db2://host.sample.fr:4461/DB2PROA" />
当我的应用程序尝试执行SQL请求时,出现此错误消息:
16:26:49,502 DEBUG SqlExceptionHelper:124 - Unable to acquire JDBC Connection [n/a]
**java.sql.SQLException: Cannot create PoolableConnectionFactory ([jcc][t4][20104][11269][3.65.131] La commande DDM n'est pas prise en charge. Point de code de la commande DDM non prise en charge : 0x106d. ERRORCODE=-4499, SQLSTATE=58014**)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2303)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2043)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1543)
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122)
at org.hibernate.internal.AbstractSessionImpl$NonContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:386)
at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:84)
at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:109)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:47)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:146)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:172)
at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:148)
at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1934)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1903)
at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1881)
at org.hibernate.loader.Loader.doQuery(Loader.java:925)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:342)
at org.hibernate.loader.Loader.doList(Loader.java:2622)
at org.hibernate.loader.Loader.doList(Loader.java:2605)
at .....
**Caused by: com.ibm.db2.jcc.am.DisconnectNonTransientException: [jcc][t4][20104][11269][3.65.131] La commande DDM n'est pas prise en charge. Point de code de la commande DDM non prise en charge : 0x106d. ERRORCODE=-4499, SQLSTATE=58014**
at com.ibm.db2.jcc.am.cd.a(cd.java:323)
at com.ibm.db2.jcc.am.cd.a(cd.java:387)
at com.ibm.db2.jcc.t4.z.lb(z.java:3142)
at com.ibm.db2.jcc.t4.z.y(z.java:763)
at com.ibm.db2.jcc.t4.z.n(z.java:674)
at com.ibm.db2.jcc.t4.z.a(z.java:475)
at com.ibm.db2.jcc.t4.z.a(z.java:118)
at com.ibm.db2.jcc.t4.b.c(b.java:1351)
at com.ibm.db2.jcc.t4.b.b(b.java:1222)
at com.ibm.db2.jcc.t4.b.b(b.java:789)
at com.ibm.db2.jcc.t4.b.a(b.java:761)
at com.ibm.db2.jcc.t4.b.a(b.java:422)
at com.ibm.db2.jcc.t4.b.a(b.java:397)
at com.ibm.db2.jcc.t4.b.<init>(b.java:335)
at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:233)
at com.ibm.db2.jcc.DB2SimpleDataSource.getConnection(DB2SimpleDataSource.java:199)
at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:475)
at com.ibm.db2.jcc.DB2Driver.connect(DB2Driver.java:116)
at org.apache.tomcat.dbcp.dbcp2.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38)
at org.apache.tomcat.dbcp.dbcp2.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:257)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2313)
at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2299)
... 73 more
16:26:49,510 WARN SqlExceptionHelper:129 - SQL Error: 0, SQLState: null