Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RestfulDriver column name ignore case #212

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

lrzl
Copy link

@lrzl lrzl commented Jan 13, 2025

因数据库列名不区分大小写,使用大写的列名寻找数据会导致找不到列
问题复现步骤:

  1. 创建表
create table column_name_test (ts timestamp,col NCHAR (64)) tags (t NCHAR (64))
  1. 写入数据
insert into data_1 using column_name_test tags ('test tag') values ('2025-01-13 00:00:00','test data');
select * from column_name_test;
           ts            |              col               |               t                |
============================================================================================
 2025-01-13 00:00:00.000 | test data                      | test tag                       |
Query OK, 1 row(s) in set (0.001425s)

3.配置RestfulDriver

... 省略
<property name="jdbcUrl" value="jdbc:TAOS-RS://tdengine:6041/unittest"/>
<property name="driverClassName" value="com.taosdata.jdbc.rs.RestfulDriver"/>
... 省略

3.执行

...
try (Connection connection = hikariDataSource.getConnection()){
              ResultSet resultSet = connection.prepareStatement("select * from column_name_test").executeQuery();
              if (resultSet.next()){
                  System.out.println("get col value:" + resultSet.getObject("col"));
                  System.out.println("get COL value:" +resultSet.getObject("COL"));
              }
 }
...

结果

get col value:test data
java.lang.RuntimeException: java.sql.SQLException: cannot find Column in resultSet

	at ...省略
Caused by: java.sql.SQLException: cannot find Column in resultSet
	at com.taosdata.jdbc.rs.RestfulResultSet.findColumn(RestfulResultSet.java:488)
	at com.taosdata.jdbc.AbstractResultSet.getObject(AbstractResultSet.java:236)
	at com.zaxxer.hikari.pool.HikariProxyResultSet.getObject(HikariProxyResultSet.java)
	at ..省略
	... 28 more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant