+-
version
oracle:Oracle 11g
java:1.8
pom.xml
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>
</dependencies>
code
package snippet;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectiongetSchemaErrorTest {
public static void main(String[] args) {
String driver = "oracle.jdbc.driver.OracleDriver";
String url = "jdbc:oracle:thin:@xx:8095/orcl";
String user = "xx";
String pswd = "xx";
try {
Class.forName(driver);
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
Connection connection = null;
try {
connection = DriverManager.getConnection(url, user, pswd);
System.out.println(connection.getClass().getName());
String schema = connection.getSchema();
System.out.println(schema);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
}
error
oracle.jdbc.driver.T4CConnection
Exception in thread "main" java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.getSchema()Ljava/lang/String;
at snippet.ConnectiongetSchemaErrorTest.main(ConnectiongetSchemaErrorTest.java:24)