caucho
Resin 1.1
FAQ
Reference
JavaDoc
Demo
Java Tutorial

Getting Started
Configuration
Servlet
JSP
XTP/XSL
JavaScript
JS Library

Core Library
File Library
Servlet Library
Database Library
XML Library

DBPool
ResultSet
 Database Pool

Although you can use the JDBC classes directly, the Resin database pool object provides some conveniences.
  • It reuses old database connections, eliminating the connection establishment.
  • It automatically closes open statements and connections when the jsp request completes.

com.caucho.sql.DBPool
new DBPool(url [, name, password]) Returns a DBPool object corresponding to the given JDBC url and given the name and password. This call does not open any connections, it merely stores the pool information for later use.
getConnection() Creates a connection to the database. If it can, DBPool will use a free connetion in the pool.

Resin will automatically free the connection as soon as the jsp request completes.

loadDriver(drivername) Loads the given classname as a JDBC driver. Essentially the same functionality as the Class.forName(drivername) suggested by JDBC.
createStatement() Creates a JDBC Statement. Essentially the same as getConnection().createStatement().
prepareStatement(sql) Creates a JDBC PreparedStatement. Essentially the same as getConnection().prepareStatement(sql).
prepareCall(sql) Creates a JDBC CallableStatement. Essentially the same as getConnection().prepareCall(sql).
close() Closes the allocated connection. This is necessar to put the connection back into the pool.
executeUpdate(sql) Sends the given sql to the database. This is the same as the JDBC statement.executeUpdate(sql) statement, but the DBPool does all the busywork of creating the connection the statement and closing them.

com.caucho.sql.DBPool

Scripts must access the DBPool object using the Packages mechanism.

new DBPool(url [, name, password])

Returns a DBPool object corresponding to the given JDBC url and given the name and password. This call does not open any connections, it merely stores the pool information for later use.

getConnection()

Creates a connection to the database. If it can, DBPool will use a free connetion in the pool.

Resin will automatically free the connection as soon as the jsp request completes.

loadDriver(drivername)

Loads the given classname as a JDBC driver. Essentially the same functionality as the Class.forName(drivername) suggested by JDBC.

createStatement()

Creates a JDBC Statement. Essentially the same as getConnection().createStatement().

prepareStatement(sql)

Creates a JDBC PreparedStatement. Essentially the same as getConnection().prepareStatement(sql).

prepareCall(sql)

Creates a JDBC CallableStatement. Essentially the same as getConnection().prepareCall(sql).

close()

Closes the allocated connection. This is necessar to put the connection back into the pool.

executeUpdate(sql)

Sends the given sql to the database. This is the same as the JDBC statement.executeUpdate(sql) statement, but the DBPool does all the busywork of creating the connection the statement and closing them.

Database Library   ResultSet
Copyright © 1998-2000 Caucho Technology. All rights reserved.
Last modified: Fri, 31 Mar 2000 18:50:24 -0800 (PST)