You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
flight-sql-jdbc-driver throws "parameter ordinal 1 out of range" for PreparedStatement in SELECT query #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:
PreparedStatement is obtained directly from the JDBC connection.
PreparedStatement.getParameterMetaData() seems to return 0 parameters.
The driver works fine for queries without placeholders or with inline values.
The Flight SQL JDBC driver appears to not support ? placeholders reliably in this version.
Question:
Is this a known limitation of the Doris Flight SQL JDBC driver?
Are there any workarounds to use PreparedStatement with parameters for SELECT queries?
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!
@eqrvivek you can use placeholders with a compatible server side implementation.
This is not the Doris Flight SQL JDBC driver. There are multiple possible server side implementations with varying degrees of protocol (Flight SQL) implementation. Doris seems to not fully implement the protocol.
You should open an issue there. The code in this repo is not the problem.
Activity
lidavidm commentedon Feb 6, 2026
Duplicate of #121?
eqrvivek commentedon Feb 6, 2026
i went through the issue details. How do i set parameter_schema? Is there any documentation i can use?
lidavidm commentedon Feb 6, 2026
That is a server-side implementation issue.
eqrvivek commentedon Feb 6, 2026
ok so right now, we can not use placeholders? and what does server side implementation means and how it can be fixed?
ennuite commentedon Feb 9, 2026
@eqrvivek you can use placeholders with a compatible server side implementation.
This is not the Doris Flight SQL JDBC driver. There are multiple possible server side implementations with varying degrees of protocol (Flight SQL) implementation. Doris seems to not fully implement the protocol.
You should open an issue there. The code in this repo is not the problem.
ennuite commentedon Feb 23, 2026
@lidavidm can we close this?