mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
兼容Oracle 10.x Driver
git-svn-id: http://code.alibabatech.com/svn/druid/trunk@327 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package com.alibaba.druid.pool;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.Driver;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLWarning;
|
||||
@@ -419,6 +420,25 @@ public class PoolableStatement extends PoolableWrapper implements Statement {
|
||||
return true;
|
||||
}
|
||||
|
||||
Driver driver = null;
|
||||
{
|
||||
ConnectionHolder holder = conn.getConnectionHolder();
|
||||
if (holder != null) {
|
||||
DruidAbstractDataSource dataSource = holder.getDataSource();
|
||||
if (dataSource != null) {
|
||||
driver = dataSource.getDriver();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Oracle Driver 10.x is JDBC 3.0
|
||||
if (driver != null) {
|
||||
if ("oracle.jdbc.driver.OracleDriver".equals(driver.getClass().getName())) {
|
||||
if (driver.getMajorVersion() <= 10) {
|
||||
return closed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
return stmt.isClosed();
|
||||
} catch (Throwable t) {
|
||||
|
||||
@@ -11,6 +11,7 @@ import javax.sql.DataSource;
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.apache.commons.dbcp.BasicDataSource;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.alibaba.druid.TestUtil;
|
||||
import com.alibaba.druid.pool.DruidDataSource;
|
||||
@@ -96,7 +97,9 @@ public class Oracle_Case3 extends TestCase {
|
||||
ResultSet rs = stmt.executeQuery("SELECT 1 FROM DUAL");
|
||||
rs.next();
|
||||
rs.close();
|
||||
Assert.isTrue(!stmt.isClosed());
|
||||
stmt.close();
|
||||
Assert.isTrue(stmt.isClosed());
|
||||
conn.close();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
|
||||
Reference in New Issue
Block a user