eqrvivek opened a new issue, #1009:
URL: https://github.com/apache/arrow-java/issues/1009

   ### Describe the usage question you have. Please include as many useful 
details as possible.
   
   
   I am using the flight-sql-jdbc-driver (version 18.x / Doris 3.x) and I am 
trying to execute a simple SELECT query with a PreparedStatement and a ? 
placeholder. However, I consistently get the following exception: 
   
   java.sql.SQLException: parameter ordinal 1 out of range
   
   Here is the minimal example of the code : 
   
   import java.sql.*;
   
   public class DorisTest 
   {
       public static void main(String[] args) throws Exception {
           // Connect to Doris Flight SQL
           String url = "jdbc:apache:arrow:flight://host:port";
           Connection conn = DriverManager.getConnection(url);
   
           // SQL with a single parameter
           String sql = "SELECT * FROM Connectors WHERE connectorID = ?";
           PreparedStatement ps = conn.prepareStatement(sql);
           ps.setInt(1, 1); // This line throws SQLException
   
           ResultSet rs = ps.executeQuery();
           while (rs.next()) {
               System.out.println(rs.getInt("connectorID"));
           }
   
           conn.close();
       }
   }
   
   The driver throws: java.sql.SQLException: parameter ordinal 1 out of range
   
   Additional observations:
   1. PreparedStatement is obtained directly from the JDBC connection.
   2. PreparedStatement.getParameterMetaData() seems to return 0 parameters.
   3. The driver works fine for queries without placeholders or with inline 
values.
   4. The Flight SQL JDBC driver appears to not support ? placeholders reliably 
in this version.
   
   Question:
   1. Is this a known limitation of the Doris Flight SQL JDBC driver?
   2. Are there any workarounds to use PreparedStatement with parameters for 
SELECT queries?
   3. If placeholders are not supported, what is the recommended way to safely 
execute parameterized queries (especially for IN clauses with multiple   
       values) in Doris Flight SQL JDBC driver?
   
   Any guidance or best practices would be greatly appreciated!
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to