Examples of queryForLong()


Examples of com.j256.ormlite.support.DatabaseConnection.queryForLong()

      pooled.releaseConnection(conn1);
      // close it behind the pool's back, bad dog
      conn1.close();
      DatabaseConnection conn2 = pooled.getReadWriteConnection();
      assertSame(conn1, conn2);
      conn2.queryForLong(pingStatement);
    } finally {
      pooled.close();
    }
  }
View Full Code Here

Examples of com.j256.ormlite.support.DatabaseConnection.queryForLong()

    long delay = 100;
    pooled.setCheckConnectionsEveryMillis(delay);
    String pingStatement = pooled.getDatabaseType().getPingStatement();
    try {
      DatabaseConnection conn1 = pooled.getReadWriteConnection();
      conn1.queryForLong(pingStatement);
      pooled.releaseConnection(conn1);
      // make it test ok once
      Thread.sleep(delay * 2);
      DatabaseConnection conn2 = pooled.getReadWriteConnection();
      assertSame(conn1, conn2);
View Full Code Here

Examples of com.j256.ormlite.support.DatabaseConnection.queryForLong()

      pooled.releaseConnection(conn1);
      // make it test ok once
      Thread.sleep(delay * 2);
      DatabaseConnection conn2 = pooled.getReadWriteConnection();
      assertSame(conn1, conn2);
      conn2.queryForLong(pingStatement);
      pooled.releaseConnection(conn2);
      // close it behind the pool's back, bad dog
      conn2.close();
      // now it should find out that the connection is bad and pull it
      Thread.sleep(delay * 2);
 
View Full Code Here

Examples of com.j256.ormlite.support.DatabaseConnection.queryForLong()

      // now it should find out that the connection is bad and pull it
      Thread.sleep(delay * 2);
      DatabaseConnection conn3 = pooled.getReadWriteConnection();
      assertNotSame(conn2, conn3);
      // this should work
      conn3.queryForLong(pingStatement);
      pooled.releaseConnection(conn3);
    } finally {
      pooled.close();
    }
  }
View Full Code Here

Examples of com.j256.ormlite.support.DatabaseConnection.queryForLong()

    pooled.setCheckConnectionsEveryMillis(delay);
    pooled.setMaxConnectionAgeMillis(delay);
    String pingStatement = pooled.getDatabaseType().getPingStatement();
    try {
      DatabaseConnection conn1 = pooled.getReadWriteConnection();
      conn1.queryForLong(pingStatement);
      pooled.releaseConnection(conn1);
      // make it test ok once
      Thread.sleep(delay * 2);
      DatabaseConnection conn2 = pooled.getReadWriteConnection();
      assertNotSame(conn1, conn2);
View Full Code Here

Examples of com.j256.ormlite.support.DatabaseConnection.queryForLong()

      pooled.releaseConnection(conn1);
      // make it test ok once
      Thread.sleep(delay * 2);
      DatabaseConnection conn2 = pooled.getReadWriteConnection();
      assertNotSame(conn1, conn2);
      conn2.queryForLong(pingStatement);
      pooled.releaseConnection(conn2);
    } finally {
      pooled.close();
    }
  }
View Full Code Here

Examples of com.j256.ormlite.support.DatabaseConnection.queryForLong()

    JdbcPooledConnectionSource pooled = new JdbcPooledConnectionSource(DEFAULT_DATABASE_URL);
    String pingStatement = pooled.getDatabaseType().getPingStatement();
    pooled.setTestBeforeGet(true);
    try {
      DatabaseConnection conn1 = pooled.getReadWriteConnection();
      conn1.queryForLong(pingStatement);
      pooled.releaseConnection(conn1);
      // close it behind the pool's back, bad dog
      conn1.close();
      DatabaseConnection conn2 = pooled.getReadWriteConnection();
      assertNotSame(conn1, conn2);
View Full Code Here

Examples of com.j256.ormlite.support.DatabaseConnection.queryForLong()

      pooled.releaseConnection(conn1);
      // close it behind the pool's back, bad dog
      conn1.close();
      DatabaseConnection conn2 = pooled.getReadWriteConnection();
      assertNotSame(conn1, conn2);
      conn2.queryForLong(pingStatement);
      pooled.releaseConnection(conn2);
      DatabaseConnection conn3 = pooled.getReadWriteConnection();
      assertSame(conn2, conn3);
      conn3.queryForLong(pingStatement);
      pooled.releaseConnection(conn3);
View Full Code Here

Examples of com.j256.ormlite.support.DatabaseConnection.queryForLong()

      assertNotSame(conn1, conn2);
      conn2.queryForLong(pingStatement);
      pooled.releaseConnection(conn2);
      DatabaseConnection conn3 = pooled.getReadWriteConnection();
      assertSame(conn2, conn3);
      conn3.queryForLong(pingStatement);
      pooled.releaseConnection(conn3);
    } finally {
      pooled.close();
    }
  }
View Full Code Here

Examples of com.j256.ormlite.support.DatabaseConnection.queryForLong()

      return;
    }
    String ping = databaseType.getPingStatement();
    DatabaseConnection conn = connectionSource.getReadOnlyConnection();
    try {
      testPingValue(conn.queryForLong(ping));
    } finally {
      connectionSource.releaseConnection(conn);
    }
  }
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.