Hi All,

We are using a connection pool in Tomcat using commons dbcp classes
DriverAdaperCPDS (with com.sybase.jdbc2.jdbc.SybDriver class from sybase)
and SharedPoolDataSource.


If there is some network problem between tomcat 4.x and sybase
12.5., the code hangs at this line:

Connection con = datasource.getConnection()

i.e. we neither get back any connection object nor any exception.

Pasted below is the code we use to create a connection pool and get back the connection.

    public static void setConnection() throws Exception
    {
        DriverAdapterCPDS cpds = new DriverAdapterCPDS();
        cpds.setDriver("com.sybase.jdbc2.jdbc.SybDriver");
        cpds.setUrl("jdbc:sybase:Tds:<IP>:<port>/<database>");
        cpds.setUser(<username>);
        cpds.setPassword(<password>);

        SharedPoolDataSource tds = new SharedPoolDataSource();
        tds.setConnectionPoolDataSource(cpds);
        tds.setMaxActive(10);
        tds.setMaxWait(50);
   }

    public static Connection getConnection() throws Exception
    {
        Connection conn = null;
        try
        {
            conn = ds.getConnection();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

        return conn;
    }


The above code, however works fine if used within a standalone java application.


Any ideas why should the above not work for a tomcat hosted application?

Regards,
Tapas

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



Reply via email to