Solved thanks to Magic! (Sorry, not sure which one of the guys that is ;))

Here's the solution for those interested:


Java code in your class
------------------------------------
PooledConnection pcon = null;
Connection con = null;

try {
        Context ctx = new InitialContext();
        ConnectionPoolDataSource ds =
(ConnectionPoolDataSource)ctx.lookup("jdbc/BMBPooledDS");
        pcon = ds.getPooledConnection();
        con = pcon.getConnection();

        Statement s = con.createStatement();
        ResultSet rs = s.executeQuery(SQL);

        while (rs.next()) {
                << usual RecordSet processing >>
        }

        rs.close();
        s.close();
}
catch (NamingException e) { System.out.println(e.toString()); }
catch (SQLException e) { System.out.println(e.toString()); }
finally { if (pcon != null) try{pcon.close();}catch(Exception e){} }


Datasources.xml
-----------------------------------
<data-source class="com.evermind.sql.ConnectionDataSource"
location="jdbc/BMBDS">
        <name>BookmarkBox Datasource</name>
        <url>jdbc:odbc:BookmarkSQL</url>
        <connection-driver>sun.jdbc.odbc.JdbcOdbcDriver</connection-driver>
        <username>mike</username>
        <password>XXXXXX</password>
</data-source>

<data-source class="com.evermind.sql.DefaultConnectionPoolDataSource"
location="jdbc/BMBPooledDS">
        <name>BookmarkBox ConnectionPool data-source</name>
        <source-location>jdbc/BMBDS</source-location>
        <inactivity-timeout>300</inactivity-timeout>
        <max-connections>5</max-connections>
</data-source>


Hope this helps, put it in some documentation or a tutorial somewhere!

Cheers,
Mike
 __
|  | The BookmarkBox
|  | http://www.bookmarkbox.com
|/\| Manage and share your bookmarks online!

Reply via email to