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.
|
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.
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.
Loads the given classname as a JDBC driver. Essentially the same
functionality as the Class.forName(drivername) suggested
by JDBC.
Creates a JDBC Statement. Essentially the same as
getConnection().createStatement() .
Creates a JDBC PreparedStatement. Essentially the same as
getConnection().prepareStatement(sql) .
Creates a JDBC CallableStatement. Essentially the same as
getConnection().prepareCall(sql) .
Closes the allocated connection. This is necessar to put the connection
back into the pool.
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.
Copyright © 1998-2000 Caucho Technology. All rights reserved.
Last modified: Fri, 31 Mar 2000 18:50:24 -0800 (PST)
|