-
Notifications
You must be signed in to change notification settings - Fork 656
Open
Labels
Description
Title: SQLException: No parameter has been set yet when using Vertx JDBC with SQLite
Description:
When executing a parameterized query with vertx-jdbc-client against SQLite, the following exception occurs:
SQLException: No parameter has been set yet
The error originates from the checkIndex method when validating parameter indices.
Stack Trace Snippet:
protected void checkIndex(int index) throws SQLException {
if (this.batch == null) {
throw new SQLException("No parameter has been set yet");
} else if (index < 1 || index > this.batch.length) {
throw new SQLException("Parameter index is invalid");
}
}Dependencies:
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-web-client</artifactId>
<version>5.0.3</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-sql-client-templates</artifactId>
<version>5.0.3</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-jdbc-client</artifactId>
<version>5.0.3</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.50.3.0</version>
</dependency>Reproduction Code:
public class SqliteQuery {
public static void main(String[] args) {
String jdbcUrl = "jdbc:sqlite:sqlite.db?journal_mode=WAL&synchronous=NORMAL";
JDBCConnectOptions connectOptions = new JDBCConnectOptions()
.setJdbcUrl(jdbcUrl)
.setAutoGeneratedKeys(false);
PoolOptions poolOptions = new PoolOptions()
.setMaxSize(1);
Pool pool = JDBCPool.pool(Vertx.vertx(), connectOptions, poolOptions);
SqlTemplate.forQuery(pool, "select * from user where name = #{name}")
.execute(Map.of("name", "test")).onSuccess(ok -> {
System.out.println(ok.stream().iterator().next());
}).onFailure((e) -> {
System.out.println("error");
});
}
}Additional Context:
The issue appears to be specific to SQLite JDBC integration with Vertx parameterized queries. Other databases (e.g., MySQL/PostgreSQL) may not exhibit this behavior.
Environment (please complete the following information):
- OS: [e.g. Windows 7]
- CPU architecture: [e.g. x86_64, arm64]
- sqlite-jdbc version [e.g. 3.39.2.0]