aliyun / aliyun-odps-jdbc

JDBC Driver for ODPS
Other
125 stars 38 forks source link

ODPS-JDBC 能建表 但是出现严重: java.sql.SQLException: create download session failed: instance id=20220311033632617gja4sll4 #136

Open baoxue113 opened 2 years ago

baoxue113 commented 2 years ago

Properties config = new Properties(); config.put("access_id", "****"); config.put("access_key", "****"); config.put("project_name", "hz_sjj_ywtg_dev"); Connection conn = DriverManager.getConnection("jdbc:odps:http://service.cn-hz-hty-d01.odps.wtops-procloud.com/api", config); ResultSet rs;

// 建表 Statement stmt = conn.createStatement(); String tableName = "test22245464563"; // 这个表是可以创建成功的 stmt.execute("drop table if exists " + tableName); // 这个表是可以创建成功的 stmt.execute("create table " + tableName + " (key int, value string)"); // 这个表是可以创建成功的 String sql; sql = "select count(*) from " + tableName + ";"; System.out.println("Running: " + sql); rs = stmt.executeQuery(sql); // 执行这行会报错 while (rs.next()) { System.out.println(String.valueOf(rs.getInt(1)) + "\t" + rs.getString(2)); }

    if (rs !=null)  rs.close();
    if (stmt != null)  stmt.close();
    if (conn!=null)  conn.close();

严重: java.sql.SQLException: create download session failed: instance id=20220311033632617gja4sll4 at com.aliyun.odps.jdbc.OdpsStatement.getResultSet(OdpsStatement.java:404) at com.aliyun.odps.jdbc.OdpsStatement.executeQuery(OdpsStatement.java:176) at odps.OdpsTest.main(OdpsTest.java:65) Caused by: ErrorCode=Local Error, ErrorMessage=Failed to create download session with tunnel endpoint http://dt.cn-hz-hty-d01.odps.wtops-procloud.com at com.aliyun.odps.tunnel.InstanceTunnel$DownloadSession.initiate(InstanceTunnel.java:315) at com.aliyun.odps.tunnel.InstanceTunnel$DownloadSession.(InstanceTunnel.java:184) at com.aliyun.odps.tunnel.InstanceTunnel$DownloadSession.(InstanceTunnel.java:145) at com.aliyun.odps.tunnel.InstanceTunnel.createDownloadSession(InstanceTunnel.java:97) at com.aliyun.odps.jdbc.OdpsStatement.getResultSet(OdpsStatement.java:398) ... 2 more Caused by: java.net.UnknownHostException: dt.cn-hz-hty-d01.odps.wtops-procloud.com at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at sun.net.NetworkClient.doConnect(NetworkClient.java:175) at sun.net.www.http.HttpClient.openServer(HttpClient.java:463) at sun.net.www.http.HttpClient.openServer(HttpClient.java:558) at sun.net.www.http.HttpClient.(HttpClient.java:242) at sun.net.www.http.HttpClient.New(HttpClient.java:339) at sun.net.www.http.HttpClient.New(HttpClient.java:357) at sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1220) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050) at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:984) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492) at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) at com.aliyun.odps.commons.transport.DefaultConnection.getResponse(DefaultConnection.java:132) at com.aliyun.odps.tunnel.InstanceTunnel$DownloadSession.initiate(InstanceTunnel.java:302) ... 6 more

三月 11, 2022 11:36:37 上午 com.aliyun.odps.jdbc.utils.OdpsLogger error 严重: exception happened: 三月 11, 2022 11:36:37 上午 com.aliyun.odps.jdbc.utils.OdpsLogger error 严重: java.sql.SQLException: create download session failed: instance id=20220311033632617gja4sll4 at com.aliyun.odps.jdbc.OdpsStatement.getResultSet(OdpsStatement.java:404) at com.aliyun.odps.jdbc.OdpsStatement.executeQuery(OdpsStatement.java:176) at odps.OdpsTest.main(OdpsTest.java:65)