|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface I_DbPool
Interface to a JDBC pool implementation.
Method Summary | |
---|---|
void |
erase(java.sql.Connection con)
Destroy the JDBC connection |
I_Info |
getInfo()
|
java.lang.String |
getUser()
|
void |
init(I_Info info)
Needs to be called after construction. |
void |
release(java.sql.Connection con)
Return the JDBC connection to the pool. |
java.sql.Connection |
reserve()
Access a JDBC connection. |
java.sql.Connection |
select(java.sql.Connection connection,
java.lang.String command,
boolean autoCommit,
I_ResultCb cb)
To have full control. |
java.sql.Connection |
select(java.sql.Connection connection,
java.lang.String command,
I_ResultCb cb)
Convenience method to execute a SELECT SQL command. |
void |
select(java.lang.String command,
I_ResultCb cb)
Convenience method to execute a SELECT SQL command in auto commit mode. |
void |
shutdown()
Close all open connections and destroy the pool. |
int |
update(java.sql.Connection conn,
java.lang.String command)
|
int |
update(java.lang.String command)
Convenience method to execute a INSERT/UPDATE/CREATE or DROP SQL command in auto commit mode. |
Methods inherited from interface org.xmlBlaster.contrib.I_ContribPlugin |
---|
getUsedPropertyKeys |
Method Detail |
---|
void init(I_Info info)
init
in interface I_ContribPlugin
info
- The configurationI_Info getInfo()
java.sql.Connection reserve() throws java.lang.Exception
java.lang.Exception
void release(java.sql.Connection con) throws java.lang.Exception
con
- The JDBC connection
java.lang.Exception
java.lang.String getUser()
void erase(java.sql.Connection con) throws java.lang.Exception
con
- The JDBC connection
java.lang.Exception
int update(java.lang.String command) throws java.lang.Exception
command
- for example INSERT INTO TEST_POLL VALUES ('1', 'EDDI')
java.lang.Exception
- Typically a SQLExceptionint update(java.sql.Connection conn, java.lang.String command) throws java.lang.Exception
java.lang.Exception
void select(java.lang.String command, I_ResultCb cb) throws java.lang.Exception
command
- for example SELECT * FROM TEST_POLLcb
- The callback handle for the retrieved ResultSet
java.lang.Exception
- Typically a SQLExceptionjava.sql.Connection select(java.sql.Connection connection, java.lang.String command, I_ResultCb cb) throws java.lang.Exception
On first call pass connection with null and a valid connection with an open transaction is returned by this method. You can now call this method passing the connection multiple times in the same transaction. When you are done you need to close the connection and put it back into the pool.
Example:Connection conn = null; try { conn = this.dbPool.select(conn, "SELECT A FROM B", new I_ResultCb() { public void result(ResultSet rs) throws Exception { // Processing result set } }); conn = this.dbPool.select(conn, "SELECT B FROM C", new I_ResultCb() { public void result(ResultSet rs) throws Exception { // Processing result set } }); } finally { if (conn != null) { conn.commit(); this.dbPool.release(conn); } }
connection
- If null a connection is createdcommand
- for example SELECT * FROM TEST_POLLcb
- The callback handle for the retrieved ResultSet
java.lang.Exception
- Typically a SQLExceptionjava.sql.Connection select(java.sql.Connection connection, java.lang.String command, boolean autoCommit, I_ResultCb cb) throws java.lang.Exception
connection
- If null a connection is createdcommand
- for example SELECT * FROM TEST_POLLautoCommit
- if true force auto commit and cleanup the connection, in this case we return nullcb
- The callback handle for the retrieved ResultSet
java.lang.Exception
- Typically a SQLExceptionvoid shutdown() throws java.lang.Exception
shutdown
in interface I_ContribPlugin
java.lang.Exception
I_Plugin
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |