Search in sources :

Example 21 with Driver

use of org.h2.Driver in project neo4j by neo4j.

the class ProcedureTest method calls_procedures_with_simple_input_type_returning_record_with_primitive_fields.

@Test
public void calls_procedures_with_simple_input_type_returning_record_with_primitive_fields() {
    try (Driver driver = GraphDatabase.driver(graphDb.boltURI(), configuration());
        Session session = driver.session()) {
        assertThat(session.run("CALL " + procedureNamespace + ".simpleInput11('string')").single()).isNotNull();
        assertThat(session.run("CALL " + procedureNamespace + ".simpleInput12(42)").single()).isNotNull();
        assertThat(session.run("CALL " + procedureNamespace + ".simpleInput13(42)").single()).isNotNull();
        assertThat(session.run("CALL " + procedureNamespace + ".simpleInput14(4.2)").single()).isNotNull();
        assertThat(session.run("CALL " + procedureNamespace + ".simpleInput15(true)").single()).isNotNull();
        assertThat(session.run("CALL " + procedureNamespace + ".simpleInput16(false)").single()).isNotNull();
        assertThat(session.run("CALL " + procedureNamespace + ".simpleInput17({foo:'bar'})").single()).isNotNull();
        assertThat(session.run("CALL " + procedureNamespace + ".simpleInput21()").single()).isNotNull();
    }
}
Also used : Driver(org.neo4j.driver.v1.Driver) Session(org.neo4j.driver.v1.Session) Test(org.junit.Test)

Example 22 with Driver

use of org.h2.Driver in project symmetric-ds by JumpMind.

the class DbSqlCommand method executeWithOptions.

@Override
protected boolean executeWithOptions(CommandLine line) throws Exception {
    BasicDataSource basicDataSource = getDatabasePlatform(false).getDataSource();
    String url = basicDataSource.getUrl();
    String user = basicDataSource.getUsername();
    String password = basicDataSource.getPassword();
    String driver = basicDataSource.getDriverClassName();
    Shell shell = new Shell();
    if (line.hasOption(OPTION_SQL)) {
        String sql = line.getOptionValue(OPTION_SQL);
        shell.runTool("-url", url, "-user", user, "-password", password, "-driver", driver, "-sql", sql);
    } else {
        shell.runTool("-url", url, "-user", user, "-password", password, "-driver", driver);
    }
    return true;
}
Also used : Shell(org.h2.tools.Shell) BasicDataSource(org.apache.commons.dbcp.BasicDataSource)

Example 23 with Driver

use of org.h2.Driver in project aries by apache.

the class AbstractTransactionTest method initTestTable.

protected void initTestTable(String jdbcUrl) throws SQLException {
    Driver d = new Driver();
    try (Connection c = d.connect(jdbcUrl, null)) {
        Statement s = c.createStatement();
        try {
            s.execute("DROP TABLE TEST_TABLE");
        } catch (SQLException sqle) {
        }
        s.execute("CREATE TABLE TEST_TABLE ( message varchar(255) )");
        c.commit();
    }
}
Also used : SQLException(java.sql.SQLException) Statement(java.sql.Statement) Connection(java.sql.Connection) Driver(org.h2.Driver)

Aggregations

Test (org.junit.Test)17 Driver (org.neo4j.driver.v1.Driver)16 Session (org.neo4j.driver.v1.Session)14 CoreClusterMember (org.neo4j.causalclustering.discovery.CoreClusterMember)10 RoutingNetworkSession (org.neo4j.driver.internal.RoutingNetworkSession)9 Record (org.neo4j.driver.v1.Record)6 Driver (org.h2.Driver)5 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)5 Transaction (org.neo4j.driver.v1.Transaction)5 SessionExpiredException (org.neo4j.driver.v1.exceptions.SessionExpiredException)5 IOException (java.io.IOException)4 Connection (java.sql.Connection)4 RemoteException (java.rmi.RemoteException)2 SQLException (java.sql.SQLException)2 Statement (java.sql.Statement)2 HashSet (java.util.HashSet)2 ReadReplica (org.neo4j.causalclustering.discovery.ReadReplica)2 BoltServerAddress (org.neo4j.driver.internal.net.BoltServerAddress)2 GuardTimeoutException (org.neo4j.kernel.guard.GuardTimeoutException)2 GraphDatabaseAPI (org.neo4j.kernel.internal.GraphDatabaseAPI)2