刘珍 created IOTDB-2734: ------------------------- Summary: [JDBC] ResultSetMetaData.getColumnTypeName ,the result is incorrect Key: IOTDB-2734 URL: https://issues.apache.org/jira/browse/IOTDB-2734 Project: Apache IoTDB Issue Type: Bug Components: Client/JDBC Affects Versions: 0.13.0-SNAPSHOT Reporter: 刘珍
问题描述: iotdb jdbc ResultSetMetaData.getColumnTypeName 返回的结果不正确。 测试用例: 下面例子中创建的时间序列类型是text,获取到的列类型是INT64. package jdbcPro; import org.apache.iotdb.jdbc.IoTDBSQLException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.util.Properties; public class JDBCTest extends Thread{ public static Connection connection = null; public static Statement statement = null; ResultSet rs = null; public void run() { try { Class.forName("org.apache.iotdb.jdbc.IoTDBDriver"); } catch (ClassNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try{ // connection = DriverManager.getConnection("jdbc:iotdb://172.20.70.4:6667/", "root", "root"); Properties p = new Properties(); p.setProperty("user", "root"); p.setProperty("password", "root"); connection = DriverManager.getConnection("jdbc:iotdb://172.20.70.31:6667/", p); statement = connection.createStatement() ; // set JDBC fetchSize statement.setFetchSize(10000); try { statement.execute("delete storage group root.**"); statement.execute("create timeseries root.sg.dev.status with datatype={color:#DE350B}*text*{color},encoding=PLAIN ;"); statement.execute("insert into root.sg.dev(time,status) values(1,3.14);"); rs = statement.executeQuery("select status from root.sg.dev"); ResultSetMetaData rsmd = rs.getMetaData(); System.out.println("列数:"+rsmd.getColumnCount()); System.out.println("列名:"+rsmd.getColumnName(1)); System.out.println("列类型号:"+rsmd.getColumnType(1)); System.out.println("列类型名:"+rsmd.getColumnTypeName(1)); System.out.println("列名:"+rsmd.getColumnName(2)); System.out.println("列类型号:"+rsmd.getColumnType(2)); {color:#DE350B} System.out.println("列类型名:"+rsmd.getColumnTypeName(2));{color} if(rs.next()){ System.out.print(rs.getString(1)); System.out.println(","+rs.getString(2)); } } catch (IoTDBSQLException e) { System.out.println(e.getMessage()); statement.close(); } } catch (SQLException e) { System.out.println(e.getMessage()); }finally{ try { close(); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } public void close() throws SQLException, InterruptedException{ if(statement != null) statement.close(); if(connection != null) connection.close(); // System.out.println("finished."); } public static void main(String[] args) throws ClassNotFoundException, SQLException, InterruptedException { JDBCTest t1 = new JDBCTest(); t1.start(); } } -- This message was sent by Atlassian Jira (v8.20.1#820001)