JDBC Driver - PolyStatement

org.polypheny.jdbc.multimodel.PolyStatement executes a statement in a named query language. Create one with PolyConnection.createPolyStatement().

execute

execute(String namespaceName, String languageName, String statement) sends the statement text to Prism and returns a Result.

Argument Meaning
namespaceName Namespace in which the server executes the statement. Pass null to use the session’s current namespace.
languageName Use sql for SQL or mongo for MongoQL.
statement Query or command in that language. Use JDBC PreparedStatement for SQL values that must be bound as parameters.

The method can throw PrismInterfaceServiceException, a subclass of SQLException. It sends the text as an unparameterized Prism statement.

Lifecycle and accessors

  • PolyStatement(PolyConnection) creates a statement bound to the given connection. The connection’s factory uses this constructor.
  • getConnection() returns the owning PolyConnection.
  • getStatementId() exposes the ID of the Prism statement. It is used when fetching additional result frames.

PolyStatement has no close() method and does not implement java.sql.Statement. Reusing the object via execute releases the previous server statement and replaces its ID. Consume each result before reusing the statement, and close the owning JDBC connection when finished.

See the runnable MongoQL example.

© Polypheny GmbH. All Rights Reserved.