use of org.apache.jena.sdb.sql.SDBConnection in project jena by apache.
the class ExJdbcConnection method query.
public static void query(String queryString, StoreDesc storeDesc, Connection jdbcConnection) {
Query query = QueryFactory.create(queryString);
SDBConnection conn = new SDBConnection(jdbcConnection);
Store store = StoreFactory.create(storeDesc, conn);
Dataset ds = DatasetStore.create(store);
QueryExecution qe = QueryExecutionFactory.create(query, ds);
try {
ResultSet rs = qe.execSelect();
ResultSetFormatter.out(rs);
} finally {
qe.close();
}
// Does not close the JDBC connection.
// Do not call : store.getConnection().close() , which does close the underlying connection.
store.close();
}
use of org.apache.jena.sdb.sql.SDBConnection in project jena by apache.
the class SDBTestUtils method createInMemoryStore.
/** Create an HSQLDB-backed in-memory store for testing. */
public static Store createInMemoryStore() {
SDBConnection conn = SDBFactory.createConnection("jdbc:hsqldb:mem:test", "sa", "");
StoreDesc desc = new StoreDesc(LayoutType.LayoutTripleNodesHash, DatabaseType.HSQLDB);
Store store = SDBFactory.connectStore(conn, desc);
store.getTableFormatter().create();
store.getTableFormatter().truncate();
return store;
}
use of org.apache.jena.sdb.sql.SDBConnection in project jena by apache.
the class StoreCreator method getHashSQLServer.
public static Store getHashSQLServer() {
if (sdbssh == null) {
JDBC.loadDriverSQLServer();
SDBConnection sdb = SDBFactory.createConnection(MSSQL_url + "test2-hash", MSSQL_user, MSSQL_password);
StoreDesc desc = new StoreDesc(LayoutType.LayoutTripleNodesHash, DatabaseType.SQLServer);
sdbssh = new StoreTriplesNodesHashSQLServer(sdb, desc);
sdbssh.getTableFormatter().create();
} else
sdbssh.getTableFormatter().truncate();
return sdbssh;
}
use of org.apache.jena.sdb.sql.SDBConnection in project jena by apache.
the class StoreCreator method getHashOracle.
public static Store getHashOracle() {
if (sdboh == null) {
JDBC.loadDriverOracle();
// "jena", "swara"
String url = JDBC.makeURL("oracle:thin", "localhost:1521", "XE");
SDBConnection sdb = new SDBConnection(url, "test2-hash", "test2-hash");
StoreDesc desc = new StoreDesc(LayoutType.LayoutTripleNodesHash, DatabaseType.Oracle);
sdboh = new StoreTriplesNodesHashOracle(sdb, desc);
sdboh.getTableFormatter().create();
} else
sdboh.getTableFormatter().truncate();
return sdboh;
}
use of org.apache.jena.sdb.sql.SDBConnection in project jena by apache.
the class StoreCreator method getIndexDerby.
public static Store getIndexDerby() {
if (sdbdi == null) {
JDBC.loadDriverDerby();
String url = JDBC.makeURL("derby", "localhost", "DB/test2-index");
SDBConnection sdb = new SDBConnection(url, null, null);
StoreDesc desc = new StoreDesc(LayoutType.LayoutTripleNodesIndex, DatabaseType.Derby);
sdbdi = new StoreTriplesNodesIndexDerby(sdb, desc);
sdbdi.getTableFormatter().create();
} else
sdbdi.getTableFormatter().truncate();
return sdbdi;
}
Aggregations