Here is a second post, the first one never appeared

I'm trying to use Pooled Connection for web application.
The application does not use EJB.

Here is my a part of data-source.xml

<data-source

                class="com.evermind.sql.DriverManagerDataSource"
                name="Expanets DataSource"
                location="jdbc/MyNotPooledDS"
                pooled-location="jdbc/MyPooledDS"
                connection-driver="com.sybase.jdbc2.jdbc.SybDriver"
                username="dba"
                password="sql"
                url="jdbc:sybase:Tds:localhost:1853"
                inactivity-timeout="30"
        />

Here is the code:

public class DbUtils
{
 private static ConnectionPoolDataSource cpds = null;
///////////////

 static
  {
   String dbsource = "jdbc/MyPooledDS";

   try
   {
   Context ctx = new InitialContext();
   cpds = (ConnectionPoolDataSource)ctx.lookup(dbsource);

   }
   catch(Exception namExc)
    {
    cpds = null;
    ShConst.log("Failed to get datasource", namExc);
    }
  }
///////////////////////////
 public static java.sql.Connection getConnection() throws SQLException
 {
   return cpds.getPooledConnection().getConnection();
 }
/////////////////////////////
}//class

Here is the exception I'm getting
java.lang.ExceptionInInitializerError: java.lang.ClassCastException:
com.evermind.sql.OrionPooledDataSource
        at ExpA.DbUtils.<clinit>(./ExpA/DbUtils.java:26)


which is related to the line :

        cpds = (ConnectionPoolDataSource)ctx.lookup(dbsource)


What's wrong ?
I suspect a few things, but I'd really appreciate ssomebody's input
before start hacking.
Thanks
~boris

Reply via email to