Package com.j256.ormlite.jdbc

Examples of com.j256.ormlite.jdbc.JdbcConnectionSource


public class Db2DatabaseTypeTest extends BaseJdbcDatabaseTypeTest {

  @Override
  protected void setDatabaseParams() throws SQLException {
    databaseUrl = "jdbc:db2:ormlitedb2";
    connectionSource = new JdbcConnectionSource(DEFAULT_DATABASE_URL);
    databaseType = new Db2DatabaseType();
  }
View Full Code Here


    // turn our static method into an instance of Main
    new ForeignCollectionMain().doMain(args);
  }

  private void doMain(String[] args) throws Exception {
    JdbcConnectionSource connectionSource = null;
    try {
      // create our data source
      connectionSource = new JdbcConnectionSource(DATABASE_URL);
      // setup our database and DAOs
      setupDatabase(connectionSource);
      // read and write some data
      readWriteData();
      System.out.println("\n\nIt seems to have worked\n\n");
    } finally {
      // destroy the data source which should close underlying connections
      if (connectionSource != null) {
        connectionSource.close();
      }
    }
  }
View Full Code Here

    // turn our static method into an instance of Main
    new DataPersisterMain().doMain(args);
  }

  private void doMain(String[] args) throws Exception {
    JdbcConnectionSource connectionSource = null;
    try {
      // create our data-source for the database
      connectionSource = new JdbcConnectionSource(DATABASE_URL);
      // setup our database and DAOs
      setupDatabase(connectionSource);
      // read and write some data
      readWriteData();
      System.out.println("\n\nIt seems to have worked\n\n");
    } finally {
      // destroy the data source which should close underlying connections
      if (connectionSource != null) {
        connectionSource.close();
      }
    }
  }
View Full Code Here

public class MysqlDatabaseTypeTest extends BaseJdbcDatabaseTypeTest {

  @Override
  protected void setDatabaseParams() throws SQLException {
    databaseUrl = "jdbc:mysql:ormlite";
    connectionSource = new JdbcConnectionSource(DEFAULT_DATABASE_URL);
    databaseType = new MysqlDatabaseType();
  }
View Full Code Here

    // turn our static method into an instance of Main
    new ForeignMain().doMain(args);
  }

  private void doMain(String[] args) throws Exception {
    JdbcConnectionSource connectionSource = null;
    try {
      // create our data source
      connectionSource = new JdbcConnectionSource(DATABASE_URL);
      // setup our database and DAOs
      setupDatabase(connectionSource);
      // read and write some data
      readWriteData();
      System.out.println("\n\nIt seems to have worked\n\n");
    } finally {
      // destroy the data source which should close underlying connections
      if (connectionSource != null) {
        connectionSource.close();
      }
    }
  }
View Full Code Here

public class SqlServerDatabaseTypeTest extends BaseJdbcDatabaseTypeTest {

  @Override
  protected void setDatabaseParams() throws SQLException {
    databaseUrl = "jdbc:sqlserver:db";
    connectionSource = new JdbcConnectionSource(DEFAULT_DATABASE_URL);
    databaseType = new SqlServerDatabaseType();
  }
View Full Code Here

public class SqliteDatabaseTypeTest extends BaseJdbcDatabaseTypeTest {

  @Override
  protected void setDatabaseParams() throws SQLException {
    databaseUrl = "jdbc:sqlite:";
    connectionSource = new JdbcConnectionSource(DEFAULT_DATABASE_URL);
    databaseType = new SqliteDatabaseType();
  }
View Full Code Here

    // turn our static method into an instance of Main
    new FieldConfigMain().doMain(args);
  }

  private void doMain(String[] args) throws Exception {
    JdbcConnectionSource connectionSource = null;
    try {
      // create our data-source for the database
      connectionSource = new JdbcConnectionSource(DATABASE_URL);
      // setup our database and DAOs
      setupDatabase(connectionSource);
      // read and write some data
      readWriteData();
      System.out.println("\n\nIt seems to have worked\n\n");
    } finally {
      // destroy the data source which should close underlying connections
      if (connectionSource != null) {
        connectionSource.close();
      }
    }
  }
View Full Code Here

    TestUtils.deleteDirectory(dbDir);
    dbDir.mkdirs();
    assertEquals(0, dbDir.list().length);
    closeConnectionSource();
    String dbUrl = "jdbc:h2:" + dbDir.getPath() + "/" + DATABASE_NAME;
    connectionSource = new JdbcConnectionSource(dbUrl);
    DatabaseConnection conn = connectionSource.getReadWriteConnection();
    try {
      databaseType = DatabaseTypeUtils.createDatabaseType(dbUrl);
      assertTrue(dbDir.list().length != 0);
    } finally {
View Full Code Here

  private final static String GENERATED_ID_SEQ = "genId_seq";

  @Override
  protected void setDatabaseParams() throws SQLException {
    databaseUrl = "jdbc:hsqldb:ormlite";
    connectionSource = new JdbcConnectionSource(DEFAULT_DATABASE_URL);
    databaseType = new HsqldbDatabaseType();
  }
View Full Code Here

TOP

Related Classes of com.j256.ormlite.jdbc.JdbcConnectionSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.