Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/main/java/org/duckdb/DuckDBConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ public Statement createStatement() throws SQLException {
return createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
}

public Connection duplicate() throws SQLException {
public DuckDBConnection duplicate() throws SQLException {
checkOpen();
connRefLock.lock();
try {
checkOpen();
return new DuckDBConnection(DuckDBNative.duckdb_jdbc_connect(connRef), url, readOnly, sessionInitSQL,
autoCommit);
ByteBuffer dupRef = DuckDBNative.duckdb_jdbc_connect(connRef);
return new DuckDBConnection(dupRef, url, readOnly, sessionInitSQL, autoCommit);
} finally {
connRefLock.unlock();
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/duckdb/TestResults.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static void test_result() throws Exception {
assertFalse(rs.next());
}
// test duplication
try (Connection conn2 = conn.unwrap(DuckDBConnection.class).duplicate();
try (DuckDBConnection conn2 = conn.unwrap(DuckDBConnection.class).duplicate();
Statement stmt2 = conn2.createStatement(); ResultSet rs_conn2 = stmt2.executeQuery("SELECT 42")) {
rs_conn2.next();
assertEquals(42, rs_conn2.getInt(1));
Expand Down