Class DatasetConnection

java.lang.Object
org.apache.jena.jdbc.connections.JenaConnection
org.apache.jena.jdbc.connections.DatasetConnection
All Implemented Interfaces:
AutoCloseable, Connection, Wrapper
Direct Known Subclasses:
MemConnection, TDBConnection

public abstract class DatasetConnection extends JenaConnection
Represents a connection to a Dataset instance
  • Constructor Details

    • DatasetConnection

      public DatasetConnection(Dataset ds, int holdability, boolean autoCommit, int transactionLevel, int compatibilityLevel) throws SQLException
      Creates a new dataset connection
      Parameters:
      ds - Dataset
      holdability - Cursor holdability
      autoCommit - Sets auto-commit behavior for the connection
      transactionLevel - Sets transaction isolation level for the connection
      compatibilityLevel - Sets JDBC compatibility level for the connection, see JdbcCompatibility
      Throws:
      SQLException
  • Method Details

    • getJenaDataset

      public final Dataset getJenaDataset()
      Gets the dataset to which this connection pertains
      Returns:
      Dataset
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface Connection
      Specified by:
      isClosed in class JenaConnection
    • isReadOnly

      public boolean isReadOnly()
      Specified by:
      isReadOnly in interface Connection
      Specified by:
      isReadOnly in class JenaConnection
    • isValid

      public boolean isValid(int timeout)
      Specified by:
      isValid in interface Connection
      Specified by:
      isValid in class JenaConnection
    • setReadOnly

      public void setReadOnly(boolean readOnly) throws SQLException
      Specified by:
      setReadOnly in interface Connection
      Specified by:
      setReadOnly in class JenaConnection
      Throws:
      SQLException
    • begin

      public void begin(ReadWrite type) throws SQLException
      Begins a new transaction

      Transactions are typically thread scoped and are shared by each thread so if there is an existing read transaction and another thread tries to start a read transaction it will join the existing read transaction. Trying to join a transaction not of the same type will produce an error.

      Parameters:
      type -
      Throws:
      SQLException