无法使用java通过jdbc驱动程序连接到Aster数据库

时间:2017-09-11 16:27:30

标签: jdbc teradata-aster aster

我正在尝试使用java中的jdbc驱动程序连接到Aster服务器。我已将Jar文件添加到类路径中。

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.*;

public class TeradataJDBCConnection {

      public static void main(String[] args) throws Exception {

          Class.forName("com.asterdata.ncluster.Driver");

          String url="jdbc:ncluster://<ip_address>:2406/test";

    Connection conn=DriverManager.getConnection(url, "user123", "test");    
   }

}

但我收到以下错误。

    Exception in thread "main" java.sql.SQLException: [AsterData][ASTERJDBCDSII](34) : Failed to connect to 10.99.186.92. Please check the host address. ()
    at com.asterdata.ncluster.jdbc.core.NClusterConnection.connect(Unknown Source)
    at com.simba.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source)
    at com.simba.jdbc.common.AbstractDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at Tera.TeradataJDBCConnection.main(TeradataJDBCConnection.java:17)
Caused by: com.asterdata.ncluster.jdbc.core.MuleException: [AsterData][ASTERJDBCDSII](34) : Failed to connect to 10.99.186.92. Please check the host address. ()
    ... 6 more

1 个答案:

答案 0 :(得分:0)

代码中没有错误。 一切都运行良好。 从这里下载jdbc驱动程序。 https://aster-community.teradata.com/docs/DOC-2254