JDBC Driver - PolyConnection

org.polypheny.jdbc.PolyConnection implements java.sql.Connection and adds access to Polypheny’s multimodel statement and Prism client. Obtain the instance from DriverManager.getConnection(…) followed by connection.unwrap(PolyConnection.class). Keep that JDBC connection open while using statements, results, or metadata through the extension.

For the standard methods of PolyConnection, including transactions, statements, client information, and settings, see the Connection reference. JDBC and multimodel statements use the same session and transaction.

Creating a multimodel statement

createPolyStatement() returns a new PolyStatement. Use it to specify a namespace and language for each call. Use the JDBC prepareStatement methods for SQL parameter binding.

Accessing Prism

getPrismInterfaceClient() returns the Prism client for this connection. It is already registered with the server. Use it for document collection metadata or other Prism requests that are unavailable through standard JDBC. Let the enclosing JDBC connection close the Prism session.

getTimeout() returns the driver’s current network timeout in milliseconds. You can pass it to the Prism metadata calls. isStrict() reports whether the JDBC connection’s strict property is enabled.

Collection metadata

Call searchEntities(namespace, entityNamePattern, timeout) on the connection’s Prism client. The name filter is optional. Use getTimeout() to reuse the connection timeout. The Document Collection Metadata guide shows the response types and Java accessors, with a runnable example. The Java integration guide includes a shorter example.

Prism client methods

The JDBC APIs handle most of these calls for you. Use the Prism client directly when you need protocol types or operations such as searchEntities that the JDBC abstraction does not expose. The public client can be constructed with PrismInterfaceClient(String host, int port, Map<String, String> parameters). To use your JDBC session, access its existing client as described above.

Operation Methods
Browse namespaces and entities getDefaultNamespace, searchNamespaces, searchEntities, getTablesTypes.
Inspect the server and language capabilities getDbmsVersion, getTypes, getSqlKeywords, getSqlStringFunctions, getSqlNumericFunctions, getSqlSystemFunctions, getSqlTimeDateFunctions, searchProcedures, searchFunctions.
Read or update session information checkConnection, getClientInfoProperties, setClientInfoProperties, setConnectionProperties.
Send query text or prepare and bind values executeUnparameterizedStatement, executeUnparameterizedStatementBatch, prepareIndexedStatement, executeIndexedStatement, executeIndexedStatementBatch. Unparameterized calls deliver responses through a callback.
Fetch results and release resources fetchResult, closeResult, closeStatement. These work with the server-side statement ID.
Manage the session and transaction register, unregister, commitTransaction, rollbackTransaction. When using a JDBC connection, let the connection manage these operations so its state stays in sync with Prism.

The v3.1 PrismInterfaceClient source lists the signatures. The Prism protocol reference describes the request and response types.

Driver lifecycle methods

The constructor accepts PolyphenyConnectionProperties and PolyphenyDatabaseMetadata and wires up an existing Prism session. The driver calls it when opening a JDBC connection. startTracking(Statement) and endTracking(Statement) maintain the connection’s list of open JDBC statements for cleanup. Application code normally uses createStatement, prepareStatement, and try-with-resources to manage that lifecycle.

© Polypheny GmbH. All Rights Reserved.