-1

我面临一个 JDBC 异常(100 次一次)。但即使在那种情况下,我也想控制那个异常并使过程顺利

Caused by: java.lang.NoClassDefFoundError
at oracle.jdbc.driver.T4CDriverExtension.allocatePreparedStatement(T4CDriverExtension.java:67)
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3559)
at oracle.jdbc.driver.PhysicalConnection.prepareStatement(PhysicalConnection.java:3445)
at oracle.jdbc.OracleDatabaseMetaData.getTables(OracleDatabaseMetaData.java:2766)
at com.mchange.v2.c3p0.impl.DefaultConnectionTester.activeCheckConnection(DefaultConnectionTester.java:70)
at com.mchange.v2.c3p0.impl.DefaultConnectionTester.statusOnException(DefaultConnectionTester.java:59)
at com.mchange.v2.c3p0.impl.C3P0PooledConnection$ProxyConnectionInvocationHandler.handleMaybeFatalToPooledConnection(C3P0PooledConnection.java:837)
at com.mchange.v2.c3p0.impl.C3P0PooledConnection$ProxyConnectionInvocationHandler.invoke(C3P0PooledConnection.java:732)
at com.mchange.v2.c3p0.impl.$Proxy55.prepareStatement(Unknown Source)
at org.springframework.jdbc.core.PreparedStatementCreatorFactory$PreparedStatementCreatorImpl.createPreparedStatement(PreparedStatementCreatorFactory.java:232)
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:581)
at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:843)
at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.update(NamedParameterJdbcTemplate.java:288)
4

1 回答 1

1

这不是 SQLException。您的问题在于您的 JDBC 驱动程序对您的应用程序不可用。换句话说,您正在尝试使用不存在的东西(驱动程序)。

解决方案:

1) 确保您拥有 Oracle 的正确 JDBC 驱动程序 ( http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html )

2) 确保为您的应用程序提供驱动程序

这是开始http://docs.oracle.com/javase/tutorial/jdbc/overview/index.html的好地方

于 2012-09-13T13:13:44.957 回答