Search in sources :

Example 36 with Server

use of herddb.server.Server in project herddb by diennea.

the class TransactionsTest method emptyTransaction.

/**
 * Commit on a connection without any work
 */
@Test
public void emptyTransaction() throws Exception {
    try (Server server = new Server(new ServerConfiguration(folder.newFolder().toPath()))) {
        server.start();
        server.waitForStandaloneBoot();
        try (HDBClient client = new HDBClient(new ClientConfiguration(folder.newFolder().toPath()))) {
            client.setClientSideMetadataProvider(new StaticClientSideMetadataProvider(server));
            try (BasicHerdDBDataSource dataSource = new BasicHerdDBDataSource(client);
                Connection con = dataSource.getConnection()) {
                con.setAutoCommit(false);
                con.commit();
            }
        }
    }
}
Also used : StaticClientSideMetadataProvider(herddb.server.StaticClientSideMetadataProvider) HDBClient(herddb.client.HDBClient) Server(herddb.server.Server) ServerConfiguration(herddb.server.ServerConfiguration) Connection(java.sql.Connection) ClientConfiguration(herddb.client.ClientConfiguration) Test(org.junit.Test)

Aggregations

Server (herddb.server.Server)36 Connection (java.sql.Connection)33 Test (org.junit.Test)33 ServerConfiguration (herddb.server.ServerConfiguration)32 Statement (java.sql.Statement)32 StaticClientSideMetadataProvider (herddb.server.StaticClientSideMetadataProvider)27 ClientConfiguration (herddb.client.ClientConfiguration)26 HDBClient (herddb.client.HDBClient)26 ResultSet (java.sql.ResultSet)25 PreparedStatement (java.sql.PreparedStatement)22 SQLException (java.sql.SQLException)6 HashSet (java.util.HashSet)3 ArrayList (java.util.ArrayList)2 HDBException (herddb.client.HDBException)1 BasicHerdDBDataSource (herddb.jdbc.BasicHerdDBDataSource)1 TableSpace (herddb.model.TableSpace)1 SQLPlanner (herddb.sql.SQLPlanner)1 DatabaseMetaData (java.sql.DatabaseMetaData)1 List (java.util.List)1 Set (java.util.Set)1