Package org.adbcj

Examples of org.adbcj.ConnectionManager.connect()


    final boolean[] callbacks = {false};
    final CountDownLatch latch = new CountDownLatch(1);

    ConnectionManager connectionManager = ConnectionManagerProvider.createConnectionManager(url, user, "__BADPASSWORD__");
    try {
      DbFuture<Connection> connectFuture = connectionManager.connect().addListener(new DbListener<Connection>() {
        public void onCompletion(DbFuture<Connection> future) throws Exception {
          callbacks[0] = true;
          latch.countDown();
        }
      });
View Full Code Here


  @Parameters({"url", "user", "password"})
  @Test(timeOut=60000)
  public void testImmediateClose(String url, String user, String password) throws InterruptedException {
    ConnectionManager connectionManager = ConnectionManagerProvider.createConnectionManager(url, user, password);
    try {
      Connection lockingConnection = connectionManager.connect().get();
      connectionManager.setPipeliningEnabled(false);
      Connection connection = connectionManager.connect().get();

      lockingConnection.beginTransaction();
      TestUtils.selectForUpdate(lockingConnection).get();
View Full Code Here

  public void testImmediateClose(String url, String user, String password) throws InterruptedException {
    ConnectionManager connectionManager = ConnectionManagerProvider.createConnectionManager(url, user, password);
    try {
      Connection lockingConnection = connectionManager.connect().get();
      connectionManager.setPipeliningEnabled(false);
      Connection connection = connectionManager.connect().get();

      lockingConnection.beginTransaction();
      TestUtils.selectForUpdate(lockingConnection).get();

      List<DbSessionFuture<ResultSet>> futures = new ArrayList<DbSessionFuture<ResultSet>>();
View Full Code Here

  public static void main(String[] args) throws Exception {
    ConnectionManager mysqlCM = ConnectionManagerProvider.createConnectionManager("adbcj:mysqlnetty://localhost/adbcjtck", "adbcjtck", "adbcjtck");
    ConnectionManager pgCM = ConnectionManagerProvider.createConnectionManager("adbcj:postgresql-netty://localhost/adbcjtck", "adbcjtck", "adbcjtck");

    Connection mysql = mysqlCM.connect().getUninterruptably();
    Connection pg = pgCM.connect().getUninterruptably();

    final String insertTemplate = "INSERT INTO large (a, b, c) VALUES ('%s', '%s', '%s')";
    for (int i = 0; i < 998; i++) {
      String a = randString();
      String b = randString();
View Full Code Here

    ConnectionManager connectionManager = ConnectionManagerProvider.createConnectionManager("adbcj:mysql://localhost/adbcjtck", "adbcjtck", "adbcjtck");

    final boolean[] callbacks = {false, false};
    final CountDownLatch latch = new CountDownLatch(2);

    DbFuture<Connection> connectFuture = connectionManager.connect().addListener(new DbListener<Connection>() {
      public void onCompletion(DbFuture<Connection> future) throws Exception {
        // Indicate that callback has been invoked
        callbacks[0] = true;
        latch.countDown();
      }
View Full Code Here

public class Test {

  public static void main(String[] args) throws DbException, Exception {
    ConnectionManager cm = ConnectionManagerProvider.createConnectionManager("adbcj:mysqlnetty://localhost/test", "foo", "dawg");
    Connection connection = cm.connect().get();
    connection.close(true);
  }

}
View Full Code Here

   * @throws InterruptedException
   * @throws org.adbcj.DbException
   */
  public static void main(String[] args) throws DbException, InterruptedException {
    ConnectionManager cm = ConnectionManagerProvider.createConnectionManager("adbcj:postgresql-netty://localhost/adbcjtck", "adbcjtck", "adbcjtck");
    Connection connection = cm.connect().get();

    final DbFuture<ResultSet> future = connection.executeQuery("SELECT * FROM simple_values");
    final DbFuture<ResultSet> future2 = connection.executeQuery("SELECT * FROM large");
    ResultSet rs = future.get();
    ResultSet rs2 = future2.get();
View Full Code Here

   * @throws InterruptedException
   * @throws DbException
   */
  public static void main(String[] args) throws DbException, InterruptedException {
    ConnectionManager cm = ConnectionManagerProvider.createConnectionManager("adbcj:postgresql-mina://localhost/adbcjtck", "adbcjtck", "adbcjtck");
    Connection connection = cm.connect().get();
 
    final ResultSet rs = connection.executeQuery("SELECT * FROM large").get();
    for (Row row : rs) {
      System.out.println(row.get(0) + " " + row.get(1));
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.