@@ -112,4 +112,43 @@ public void testUseDatabase() {
112112 fail (e .getMessage ());
113113 }
114114 }
115+
116+ @ Test
117+ public void testCreateSessionWithCapitalDB () {
118+ final String [] table2Names = new String [] {"table2" };
119+ final String [] table2ttls = new String [] {"6600000" };
120+
121+ try (final ITableSession session =
122+ EnvFactory .getEnv ().getTableSessionConnectionWithDB ("TEST2" )) {
123+
124+ session .executeNonQueryStatement ("CREATE DATABASE test1" );
125+ session .executeNonQueryStatement ("CREATE DATABASE test2" );
126+
127+ // or use full qualified table name
128+ session .executeNonQueryStatement (
129+ "create table test1.table1(region_id STRING ID, plant_id STRING ID, device_id STRING ID, model STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, humidity DOUBLE MEASUREMENT) with (TTL=3600000)" );
130+
131+ session .executeNonQueryStatement (
132+ "create table table2(region_id STRING ID, plant_id STRING ID, color STRING ATTRIBUTE, temperature FLOAT MEASUREMENT, speed DOUBLE MEASUREMENT) with (TTL=6600000)" );
133+
134+ try (final SessionDataSet dataSet = session .executeQueryStatement ("SHOW TABLES" )) {
135+ int cnt = 0 ;
136+ assertEquals (showTablesColumnHeaders .size (), dataSet .getColumnNames ().size ());
137+ for (int i = 0 ; i < showTablesColumnHeaders .size (); i ++) {
138+ assertEquals (
139+ showTablesColumnHeaders .get (i ).getColumnName (), dataSet .getColumnNames ().get (i ));
140+ }
141+ while (dataSet .hasNext ()) {
142+ final RowRecord rowRecord = dataSet .next ();
143+ assertEquals (table2Names [cnt ], rowRecord .getFields ().get (0 ).getStringValue ());
144+ assertEquals (table2ttls [cnt ], rowRecord .getFields ().get (1 ).getStringValue ());
145+ cnt ++;
146+ }
147+ assertEquals (table2Names .length , cnt );
148+ }
149+
150+ } catch (final IoTDBConnectionException | StatementExecutionException e ) {
151+ fail (e .getMessage ());
152+ }
153+ }
115154}
0 commit comments