当前位置: 首页>>代码示例>>Java>>正文


Java JDBCConnection类代码示例

本文整理汇总了Java中org.hsqldb.jdbc.JDBCConnection的典型用法代码示例。如果您正苦于以下问题:Java JDBCConnection类的具体用法?Java JDBCConnection怎么用?Java JDBCConnection使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JDBCConnection类属于org.hsqldb.jdbc包,在下文中一共展示了JDBCConnection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: JDBCXAConnectionWrapper

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
public JDBCXAConnectionWrapper(JDBCXAResource xaResource,
                               JDBCXAConnection xaConnection,
                               JDBCConnection databaseConnection)
                               throws SQLException {
    // todo: Review JDBCXADataSource and this class.
    //       Under current implementation, because we do not pass a
    //       JDBCXAConnection instance to the constructor to pick
    //       up the connectionClosed event listener callback, calling
    //       close() on this wrapper connection does not reset the
    //       physical connection or set the inUse flag to false until
    //       the vending JDBCXAConnection itself is closed, which marks
    //       the end of its useful life.
    //
    //       In other words, due to this current implementation detail,
    //       JDBCXADataSource cannot cooperate with a pooling implementation
    //       to reuse physical connections.
    //       fixed - the event listener works
    super(databaseConnection, xaConnection);

    xaResource.setConnection(this);

    this.xaResource = xaResource;
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:24,代码来源:JDBCXAConnectionWrapper.java

示例2: getXAConnection

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
/**
     * Get new XAConnection connection, to be managed by a connection manager.
     */
    public XAConnection getXAConnection() throws SQLException {

        // Comment out before public release:
/*
        System.err.print("Executing " + getClass().getName()
                         + ".getXAConnection()...");
*/

        // Use JDBCDriver directly so there is no need to register with DriverManager
        JDBCConnection connection =
            (JDBCConnection) JDBCDriver.getConnection(url, connectionProps);
        JDBCXAConnection xaConnection = new JDBCXAConnection(this, connection);

        return xaConnection;
    }
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:19,代码来源:JDBCXADataSource.java

示例3: getQueryObjectGenerator

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
/**
     * Retrieves the QueryObjectGenerator for the given JDBC driver.  If the
     * JDBC driver does not provide its own QueryObjectGenerator, NULL is
     * returned.
     * @return The QueryObjectGenerator for this JDBC Driver or NULL if the driver does not provide its own
     * implementation
     * @exception SQLException if a database access error occurs
     * @since JDK 1.6, HSQLDB 1.8.x
     */
//#ifdef JAVA6BETA
/*
    public QueryObjectGenerator getQueryObjectGenerator() throws SQLException {
        return null;
    }
*/

//#endif JAVA6BETA
    // ------------------------ internal implementation ------------------------
    private PooledConnection createPooledConnection(JDBCConnection connection)
    throws SQLException {

        LifeTimeConnectionWrapper connectionWrapper =
            new LifeTimeConnectionWrapper(connection, this.connectionDefaults);
        JDBCPooledConnection pooledConnection =
            new JDBCPooledConnection(connectionWrapper);

        connectionWrapper.setPooledConnection(pooledConnection);

        return pooledConnection;
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:31,代码来源:JDBCConnectionPoolDataSource.java

示例4: getXAConnection

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
/**
     * Get new XAConnection connection, to be managed by a connection manager.
     */
    public XAConnection getXAConnection() throws SQLException {

        // Comment out before public release:
/*
        System.err.print("Executing " + getClass().getName()
                         + ".getXAConnection()...");
*/

        // Use JDBCDriver directly so there is no need to regiser with DriverManager
        JDBCConnection connection =
            (JDBCConnection) JDBCDriver.getConnection(url, connectionProps);
        JDBCXAConnection xaConnection = new JDBCXAConnection(this, connection);

        return xaConnection;
    }
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:19,代码来源:JDBCXADataSource.java

示例5: connect

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
/**
 * Called by DAOs to get a connection object
 * 
 * @return a connection connection from the pool. The connection should be
 *         returned using disconnect() after doing it's unit of work.
 */
public Connection connect() {
	if (pool.isEmpty()) {
		try {
			// Speedhack: The proper way of creating a connection is by looking it
			// up via JDBC url. However, that's time consuming and we need the
			// connection ASAP.
			return new JDBCConnection(props);
		}
		catch (SQLException e) {
			e.printStackTrace();
			return null;
		}
	}
	return pool.pop();
}
 
开发者ID:onyxbits,项目名称:raccoon4,代码行数:22,代码来源:DatabaseManager.java

示例6: JDBCXAConnectionWrapper

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
public JDBCXAConnectionWrapper(JDBCXAResource xaResource,
                               JDBCConnection databaseConnection)
                               throws SQLException {
    // TODO: Review JDBCXADataSource and this class.
    //       Under current implementation, because we do not pass a
    //       JDBCXAConnection instance to the constructor to pick
    //       up the connectionClosed event listener callback, calling
    //       close() on this wrapper connection does not reset the
    //       physical connection or set the inUse flag to false until
    //       the vending JDBCXAConnection itself is closed, which marks
    //       the end of its useful life.
    //
    //       In other words, due to this current implementation detail,
    //       JDBCXADataSource cannot cooperate with a pooling implementation
    //       to reuse physical connections.
    super(databaseConnection, null);

    xaResource.setConnection(this);

    this.xaResource = xaResource;
}
 
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:22,代码来源:JDBCXAConnectionWrapper.java

示例7: getCustomResult

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
public static ResultSet getCustomResult(Connection connection, long start,
        long end) throws SQLException {

    Result result = newTwoColumnResult();

    if (end < start) {
        long temp = start;

        start = end;
        end   = temp;
    }

    if (end > 1000) {
        throw org.hsqldb.jdbc.JDBCUtil.invalidArgument(
            "value larger than 100");
    }

    if (end > start + 100) {
        end = start + 100;
    }

    for (long i = start; i < end; i++) {
        Object[] row = new Object[2];

        row[0] = Long.valueOf(i);
        row[1] = new BinaryData(BigInteger.valueOf(i).toByteArray(),
                                false);

        result.navigator.add(row);
    }

    result.navigator.reset();

    return new JDBCResultSet((JDBCConnection) connection, null, result,
                             result.metaData);
}
 
开发者ID:tiweGH,项目名称:OpenDiabetes,代码行数:37,代码来源:TestJavaFunctions.java

示例8: JDBCXAResource

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
/**
 * @param connection A non-wrapped JDBCConnection which we need in
 *        order to do real (non-wrapped) commits, rollbacks, etc.
 *        This is not for the end user.  We need the real thing.
 */
public JDBCXAResource(JDBCConnection connection,
                      JDBCXADataSource xaDataSource) {

    // We're getting a real Connection here and not a wrapper.
    this.connection   = connection;
    this.xaDataSource = xaDataSource;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:13,代码来源:JDBCXAResource.java

示例9: JDBCXAConnectionWrapper

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
public JDBCXAConnectionWrapper(
        JDBCConnection connection, JDBCXAResource xaResource,
        ConnectionDefaults connectionDefaults) throws SQLException {

    /* Could pass in the creating XAConnection, which has methods to
     * get the connection and the xaResource, but this way cuts down
     * on the inter-dependencies a bit. */
    super(connection, connectionDefaults);

    this.xaResource = xaResource;
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:12,代码来源:JDBCXAConnectionWrapper.java

示例10: LifeTimeConnectionWrapper

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
public LifeTimeConnectionWrapper(
        JDBCConnection connection,
        ConnectionDefaults connectionDefaults) throws SQLException {

    this.connection = connection;

    if (connectionDefaults != null) {
        this.connectionDefaults = connectionDefaults;

        this.connectionDefaults.setDefaults(connection);
    } else {
        this.connectionDefaults = new ConnectionDefaults(connection);
    }
}
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:15,代码来源:LifeTimeConnectionWrapper.java

示例11: DatabaseManager

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
/**
 * Create a new manager.
 * 
 * @param databaseDir
 *          directory to keep the files in.
 * @throws SQLException
 *           if the DAO table cannot be initialized.
 */
public DatabaseManager(File databaseDir) throws SQLException {
	pool = new Stack<Connection>();
	props = new HsqlProperties();
	props.setProperty("connection_type", "file:");
	props.setProperty("database",
			new File(databaseDir, DBNAME).getAbsolutePath());
	daos = new HashMap<Class<?>, Object>();
	daoversions = new HashMap<String, Integer>();

	Connection c = new JDBCConnection(props);
	Statement st = null;
	ResultSet res = null;
	try {
		// Load the DAO version table
		st = c.createStatement();
		st.execute("CREATE TABLE IF NOT EXISTS versions (dao VARCHAR(255), version INT)");
		st.close();

		st = c.createStatement();
		st.execute("SELECT dao, version FROM versions");
		res = st.getResultSet();
		while (res.next()) {
			daoversions.put(res.getString(1), res.getInt(2));
		}
	}
	finally {
		if (res != null) {
			res.close();
		}
		if (st != null) {
			st.close();
		}
		pool.push(c);
	}
}
 
开发者ID:onyxbits,项目名称:raccoon4,代码行数:44,代码来源:DatabaseManager.java

示例12: getXAConnection

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
/**
     * Get new XAConnection connection, to be managed by a connection manager.
     */
    public XAConnection getXAConnection() throws SQLException {

        // Comment out before public release:
/*
        System.err.print("Executing " + getClass().getName()
                         + ".getXAConnection()...");
*/
        // Use JDBCDriver directly so there is no need to regiser with DriverManager
        JDBCConnection connection = (JDBCConnection) JDBCDriver.getConnection(url, connectionProps);
        JDBCXAConnection xaConnection = new JDBCXAConnection(this, connection);

        return xaConnection;
    }
 
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:17,代码来源:JDBCXADataSource.java

示例13: getCustomResult

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
public static ResultSet getCustomResult(Connection connection, long start,
        long end) throws SQLException {

    Result result = newTwoColumnResult();

    if (end < start) {
        long temp = start;

        start = end;
        end   = temp;
    }

    if (end > 1000) {
        throw org.hsqldb.jdbc.Util.invalidArgument(
            "value larger than 100");
    }

    if (end > start + 100) {
        end = start + 100;
    }

    for (long i = start; i < end; i++) {
        Object[] row = new Object[2];

        row[0] = Long.valueOf(i);
        row[1] = new BinaryData(BigInteger.valueOf(i).toByteArray(),
                                false);

        result.navigator.add(row);
    }

    result.navigator.reset();

    return new JDBCResultSet((JDBCConnection) connection, null, result,
                             result.metaData);
}
 
开发者ID:RabadanLab,项目名称:Pegasus,代码行数:37,代码来源:TestJavaFunctions.java

示例14: abort

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
public void abort(Executor executor) throws SQLException {
	try {
		((JDBCConnection)hsqlDBConnection).abort(executor);
	} catch (Exception e) {
		throw new UcanaccessSQLException(e);
	}
}
 
开发者ID:andrew-nguyen,项目名称:ucanaccess,代码行数:8,代码来源:UcanaccessConnection.java

示例15: check

import org.hsqldb.jdbc.JDBCConnection; //导入依赖的package包/类
private void check(final DataSource ds, final String name) throws SQLException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
    // the first "cast part" is not important, we just want to check the jdbc url is ok
    assertThat(ds, instanceOf(BasicManagedDataSource.class));
    final BasicManagedDataSource dbcp = (BasicManagedDataSource) ds;
    final Connection connection = dbcp.getConnection();
    assertThat(connection, instanceOf(ManagedConnection.class));
    final ManagedConnection mc = (ManagedConnection) connection;
    final Method getInnermostDelegateInternal = DelegatingConnection.class.getDeclaredMethod("getInnermostDelegateInternal");
    getInnermostDelegateInternal.setAccessible(true);
    final Connection delegate = (Connection) getInnermostDelegateInternal.invoke(mc);
    assertThat(delegate, instanceOf(JDBCConnection.class));
    final Method getURL = JDBCConnection.class.getDeclaredMethod("getURL");
    getURL.setAccessible(true);
    assertEquals("jdbc:hsqldb:mem:" + name, getURL.invoke(delegate));
}
 
开发者ID:apache,项目名称:tomee,代码行数:16,代码来源:DataSourceDefinitionGlobalJPATest.java


注:本文中的org.hsqldb.jdbc.JDBCConnection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。