You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "xinyiZzz (via GitHub)" <gi...@apache.org> on 2023/11/16 02:50:16 UTC

[I] [Java] jdbc:arrow-flight-sql how to execute query without using `PreparedStatement` [arrow]

xinyiZzz opened a new issue, #38742:
URL: https://github.com/apache/arrow/issues/38742

   ### Describe the usage question you have. Please include as many useful details as  possible.
   
   
   I use the following code to connect to flight sql server to execute query, which will call the server's `createPreparedStatement` method, but unfortunately I unimplemented `createPreparedStatement`.
   
   How to call server's `getFlightInfoStatement` to execute query? I didn't find the implementation in `FlightSqlClient.java`.
   
   ```
   Connection conn = null;
   Statement stmt = null;
   Class.forName("org.apache.arrow.driver.jdbc.ArrowFlightJdbcDriver");
   try {
       conn = DriverManager.getConnection("jdbc:arrow-flight-sql://xx:xx?useServerPrepStmts=false&cachePrepStmts=true&useSSL=false&useEncryption=false", "root", "");
   
       String sql = "select * from clickbench.hits limit 50";
       stmt = conn.createStatement();
       ResultSet rs = stmt.executeQuery(sql);
       int rowNum = rs.getRow();
       System.out.println(rowNum);
       rs.close();
       stmt.close();
       conn.close();
   } catch (SQLException e) {
       throw new RuntimeException(e);
   }
   ```
   
   ### Component(s)
   
   FlightRPC, Java


-- 
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: issues-unsubscribe@arrow.apache.org.apache.org

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


Re: [I] [Java] jdbc:arrow-flight-sql how to execute query without using `PreparedStatement` [arrow]

Posted by "jduo (via GitHub)" <gi...@apache.org>.
jduo commented on issue #38742:
URL: https://github.com/apache/arrow/issues/38742#issuecomment-1814925069

   FlightSqlClient has execute() overloads that take in a query text and return a FlightInfo.
   
   The JDBC driver internally always prepares and executes a query, even if you use Statement#execute(). This can be changed to support using the direct-execution RPC.


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [I] [Java] jdbc:arrow-flight-sql how to execute query without using `PreparedStatement` [arrow]

Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz closed issue #38742: [Java] jdbc:arrow-flight-sql how to execute query without using `PreparedStatement`
URL: https://github.com/apache/arrow/issues/38742


-- 
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: issues-unsubscribe@arrow.apache.org

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


Re: [I] [Java] jdbc:arrow-flight-sql how to execute query without using `PreparedStatement` [arrow]

Posted by "xinyiZzz (via GitHub)" <gi...@apache.org>.
xinyiZzz commented on issue #38742:
URL: https://github.com/apache/arrow/issues/38742#issuecomment-1815593949

   > FlightSqlClient has execute() overloads that take in a query text and return a FlightInfo.
   > 
   > The JDBC driver internally always prepares and executes a query, even if you use Statement#execute(). This can be changed to support using the direct-execution RPC.
   
   That explains it, thanks for your reply.
   
   I will implement a series of methods of `PreparedStatement`.


-- 
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: github-unsubscribe@arrow.apache.org

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