[Java][FlightRPC] Flight SQL JDBC driver parameter getting an exception: parameter ordinal 1 out of range
- Langage dominant
- Java
- Étoiles
- 94
- Forks
- 152
- Merge moyen
- 3 j 16 h
- PR mergées (30 j)
- 11
Description
### Describe the bug, including details regarding any error messages, version, and platform.
```
protected AvaticaParameter getParameter(int param) throws SQLException {
try {
return (AvaticaParameter)this.getSignature().parameters.get(param - 1);
} catch (IndexOutOfBoundsException var3) {
throw AvaticaConnection.HELPER.toSQLException(AvaticaConnection.HELPER.createException("parameter ordinal " + param + " out of range"));
}
}
```
Getting this exception
My code:
```
public static void handleSqlStatements() throws SQLException {
String url = "jdbc:arrow-flight://localhost:5000;useEncryption=false;useServerPrepStmts=false;";
String sql = "select * from MixedTypeDB.`Table` where OID=?"; // Example SQL query
System.out.println("SQL query: " + sql); // Debugging: Log the query
try (var connection = DriverManager.getConnection(url)) {
ArrowFlightPreparedStatement pstmt = (ArrowFlightPreparedStatement)connection.prepareStatement(sql);
ParameterMetaData metadata = pstmt.getParameterMetaData();
pstmt.setInt(1, 12345); // crashing here
System.out.println("Executing SQL query: " + sql);
try (final ResultSet rs = pstmt.executeQuery()) {
}
} catch (SQLException e) {
e.printStackTrace();
}
}
```
```
org.apache.arrow
flight-sql-jdbc-driver
13.0.0
```
### Component(s)
Java
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par le point d’entrée getParameter(int param) présenté dans l’issue et reproduisez l’échec via handleSqlStatements() en utilisant l’URL JDBC de Flight SQL, la requête préparée et setInt(1, 12345). Suivez la manière dont la requête préparée obtient sa liste de paramètres et vérifiez que la requête d’exemple accepte l’ordinal 1 et s’exécute sans l’exception d’indice hors limites.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- java, sql
- Domaine
- backend, database
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- À l'abandon
- Clarté
- À clarifier
- Accessibilité débutants
- 25/100