Replies: 1 comment 6 replies
-
Hello! |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello
I created the library table of duckdb through the following method, and then query it. It is OK at first, but an error will be reported after trying several times.
The creation code is as follows:
public static void createTableFromFile() {
try {
Class.forName("org.duckdb.DuckDBDriver");Properties ro_prop = new Properties();
ro_prop.setProperty("duckdb.read_only", "false");
Connection conn = DriverManager.getConnection("jdbc:duckdb:C:\test\duckdb\test743.db",ro_prop);
}
The query code is as follows:
public static void main(String[] args) {
System.out.println("++++++++++++++");
String sql1="SELECT * FROM test";
queryTest(sql1);
String sql2="SELECT s_id,sum(s_value) FROM test group by s_id ";
queryTest(sql2);
}
public static int queryTest(String sql) {
int count=0;
System.out.println("Start query statement:"+sql);
try
{
Properties ro_prop = new Properties();
ro_prop.setProperty("duckdb.read_only", "false");
DuckDBConnection conn = (DuckDBConnection) DriverManager.getConnection("jdbc:duckdb:C:\test\duckdb\test.db");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(sql);
rs.close();
stmt.close();
conn.close();
System.out.println("query was successful!");
}catch(Exception e) {
e.printStackTrace();
}
return count;
}
The error log is as follows:
++++++++++++++
Start query statement:SELECT * FROM test
query was successful!
Start query statement:SELECT s_id,sum(s_value) FROM test group by s_id
java.sql.SQLException: IO Error: Cannot open file "C:\test\duckdb\test.db": wanted=262144 read=0
at org.duckdb.DuckDBNative.duckdb_jdbc_startup(Native Method)
at org.duckdb.DuckDBDatabase.(DuckDBDatabase.java:22)
at org.duckdb.DuckDBDriver.connect(DuckDBDriver.java:35)
at java.sql.DriverManager.getConnection(Unknown Source)
Error after multiple queries
Beta Was this translation helpful? Give feedback.
All reactions