JDBC connection.getschema() AbstractMethodError

♀尐吖头ヾ 提交于 2019-12-24 09:58:15

问题


I am trying get the default database name from the connection for Teradata. I am using Teradata JDBC Driver 15.10.00.33.

The following code gives me this abstract method error. Can anyone suggest me how I can get default database name using jdbc?

Exception in thread "main" java.lang.AbstractMethodError: com.teradata.jdbc.jdk6.JDK6_SQL_Connection.getSchema()Ljava/lang/String;
public class TestTDConnection {

    public static void main(String args[]) {

        String tdConnString = "jdbc:teradata://xx/database=xx";

        try {
            Connection conn = DriverManager.getConnection(tdConnString,"xx","xx");
            System.out.println(conn.getSchema());
        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}

回答1:


If you look at the javadoc for getSchema(), you will notice the following:

Since:
1.7

That means you need a Java 7 driver, and the classname in the error message is an obvious indication that you're using a Java 6 driver:

com.teradata.jdbc.jdk6.JDK6_SQL_Connection

Replace the driver .jar file with a Java 7 (JDBC 4.1) compliant driver.

Or don't use Java 7 features.



来源:https://stackoverflow.com/questions/41308635/jdbc-connection-getschema-abstractmethoderror

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!