You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/10/10 06:33:00 UTC

[GitHub] [shardingsphere] peilinqian opened a new issue, #19987: ss-jdbc ResultSet does not support getRow() method

peilinqian opened a new issue, #19987:
URL: https://github.com/apache/shardingsphere/issues/19987

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more details. 
   If no response anymore and we cannot reproduce it on current information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   we find java version: java8, full_version=1.8.0_282
   ShardingSphere-5.1.3-SNAPSHOT
   Commit ID: dirty-9dd0d3990c849d50c17c6dc7c92ec2d4ce0ad7e5
   Commit Message: Implements openGauss version function by calcite (#19327)
   Branch: 9dd0d3990c849d50c17c6dc7c92ec2d4ce0ad7e5
   Build time: 2022-08-04T19:57:18+0800
   
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   
   ### Expected behavior
   ResultSet.getRow() returns the row number of the query result
   
   ### Actual behavior
   ResultSet.getRow() returns exception
   ```
   Exception in thread "main" java.sql.SQLFeatureNotSupportedException: getRow
   	at org.apache.shardingsphere.driver.jdbc.unsupported.AbstractUnsupportedOperationResultSet.getRow(AbstractUnsupportedOperationResultSet.java:90)
   	at com.feature.traffic.mydriver.main(mydriver.java:19)
   ```
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.
   ```
   import java.sql.Connection;
   import java.sql.DriverManager;
   import java.sql.PreparedStatement;
   import java.sql.ResultSet;
   
   public class mydriver {
   	public static void main(String[] args) throws Exception {
   		Class.forName("org.apache.shardingsphere.driver.ShardingSphereDriver");
   		String jdbcUrl = "jdbc:shardingsphere:classpath:mode-sharding-databases-tables.yaml";
   
   		String sql = "SELECT o.* FROM t_order o WHERE o.user_id=? ";
   		try (Connection conn = DriverManager.getConnection(jdbcUrl);
   				PreparedStatement ps = conn.prepareStatement(sql)) {
   			ps.setInt(1, 1);
   			try (ResultSet rs = ps.executeQuery()) {
   				while (rs.next()) {
   					System.out.println(rs.getRow());//exception
   					System.out.println(rs.getString(1));
   					System.out.println(rs.getString(2));
   					System.out.println(rs.getString(3));
   					System.out.println(rs.getString(4));
   				}
   			}
   		}
   	}
   }
   
   ```
   ### Example codes for reproduce this issue (such as a github link).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] peilinqian commented on issue #19987: ss-jdbc ResultSet does not support getRow() method

Posted by GitBox <gi...@apache.org>.
peilinqian commented on issue #19987:
URL: https://github.com/apache/shardingsphere/issues/19987#issuecomment-1277172243

   ```
   package com.feature.traffic.mytest;
   
   import java.sql.Connection;
   import java.sql.PreparedStatement;
   import java.sql.ResultSet;
   
   import com.zaxxer.hikari.HikariDataSource;
   
   public class mydriver1 {
   	public static void main(String[] args) throws Exception {
   	String driverClassName = "org.apache.shardingsphere.driver.ShardingSphereDriver";
   		String jdbcUrl = "jdbc:shardingsphere:classpath:mode-sharding-databases-tables.yaml";
   
   		// 以 HikariCP 为例
   		HikariDataSource dataSource = new HikariDataSource();
   		dataSource.setDriverClassName(driverClassName);
   		dataSource.setJdbcUrl(jdbcUrl);
   
   		String sql = "SELECT o.* FROM t_ssdb_tb o WHERE o.id=?";
   		try (Connection conn = dataSource.getConnection(); PreparedStatement ps = conn.prepareStatement(sql)) {
   			ps.setInt(1, 1);
   			try (ResultSet rs = ps.executeQuery()) {
   				while (rs.next()) {
   					System.out.println(rs.getRow());
   					System.out.println(rs.getString(1));
   					System.out.println(rs.getString(2));
   					System.out.println(rs.getString(3));
   					System.out.println(rs.getString(4));
   				}
   			}
   			conn.close();
   		}
   		dataSource.close();
   	}
   }
   ```
   
   ```
   schemaName: test_db
   
   mode:
     type: Cluster
     repository:
       type: ZooKeeper
       props:
         namespace: governance_ds
         server-lists: 7.212.123.28:2181
         retryIntervalMilliseconds: 50000
         timeToLiveSeconds: 60000
         maxRetries: 3
         operationTimeoutMilliseconds: 50000
     
   props:
     sql-show: true
   ```
   
   
   
   
   ```
   [INFO ] 2022-10-13 15:38:23,943 --main-- [com.zaxxer.hikari.HikariDataSource] HikariPool-1 - Starting... 
   [ERROR] 2022-10-13 15:38:25,357 --main-- [com.zaxxer.hikari.pool.HikariPool] HikariPool-1 - Exception during pool initialization. 
   org.yaml.snakeyaml.constructor.ConstructorException: Cannot create property=mode for JavaBean=org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration@1cbbffcd
    in 'reader', line 1, column 1:
       schemaName: test_db
       ^
   Cannot create property=overwrite for JavaBean=org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration@31c88ec8
    in 'reader', line 4, column 3:
         type: Cluster
         ^
   Unable to find property 'overwrite' on class: org.apache.shardingsphere.infra.yaml.config.pojo.mode.YamlModeConfiguration
    in 'reader', line 14, column 14:
         overwrite: false
                    ^
   
    in 'reader', line 4, column 3:
         type: Cluster
         ^
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] closed issue #19987: ss-jdbc ResultSet does not support getRow() method

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #19987:  ss-jdbc ResultSet does not support getRow() method
URL: https://github.com/apache/shardingsphere/issues/19987


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] commented on issue #19987: ss-jdbc ResultSet does not support getRow() method

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #19987:
URL: https://github.com/apache/shardingsphere/issues/19987#issuecomment-1272349023

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org