HI, currently I use Pool Connection like this bottom here,
And Works.

Only one Connection is made for every COnnection made
then ...

I tried to recompile for a code changes,

a new connection is built again,
so every recompile DataSource is built, so the old connection is leak, and the 
new code use new connection

what should I do ?
I use tomcat 5.5

thanks ?



Jdbc3PoolingDataSource source = new Jdbc3PoolingDataSource();
source.setDataSourceName("DataSource");
source.setServerName("localhost");
source.setDatabaseName("test");
source.setUser("testuser");
source.setPassword("testpassword");
source.setMaxConnections(10);
new InitialContext().rebind("DataSource", source);

Connection con = null;
try {
    DataSource source = (DataSource)new InitialContext().lookup("DataSource");
    con = source.getConnection();
    // use connection
} catch (SQLException e) {
    // log error
} catch (NamingException e) {
    // DataSource wasn't found in JNDI
} finally {
    if (con != null) {
        try { con.close(); } catch (SQLException e) {}
    }
}

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to