What are the differences between the jar files that you have in each
/WEB-INF/lib folder ?
Judging by the class cast exception, i'd advise you to try temporarily
removing the jars from your "bigger" webapps /lib folder, and run the same
code again.
regards,
M
"Michael
Nicholson" To: "Tomcat Users List"
<[EMAIL PROTECTED]>
<[EMAIL PROTECTED] cc:
u> Subject: Re: Connection pool question:
06/11/2002 14:11
Please respond to
"Tomcat Users
List"
The Code of DBQuery follows: Remember, in one webapp, it works fine, in
another, it gives a class cast exception at the ***'d line....
<begin code snippet>
/*
* DBQuery.java
*
* Created on November 5, 2002, 10:14 AM
*/
package DBCPTestClasses;
import java.sql.*;
import javax.naming.*;
import javax.sql.*;
/**
*
* @author man
*/
public class DBQuery
{
Context initContext = null;
Context envContext = null;
DataSource ds = null;
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
/** Creates a new instance of DBQuery */
public DBQuery() throws NamingException
{
initContext = new InitialContext();
envContext = (Context)initContext.lookup("java:comp/env");
ds = (DataSource) envContext.lookup("jdbc/myoracle"); //***<- Class
Cast Exception Occurs Here
}
/**
* Runs an SQL Query and returns the results as a resultset
* @returns ResultSet
*/
public ResultSet select(String SQLStr) throws SQLException
{
con = ds.getConnection();
stmt =
con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_
ONLY);
rs = stmt.executeQuery(SQLStr);
return rs;
}
/**
* Closes all connections and such
*/
public boolean close()
{
try
{
rs.close();
rs = null;
stmt.close();
stmt = null;
con.close();
con = null;
return true;
} catch (SQLException ex) {
throw new RuntimeException("There was an error closing the connection
variables--> " + ex.getMessage());
} finally {
if(rs!=null) rs = null;
if(stmt!=null) stmt = null;
if(con!=null) con = null;
}
}
}
</End Code Snippet>
So that's it. Any insight? Thanks...
Mike
--
To unsubscribe, e-mail: <
mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <
mailto:tomcat-user-help@;jakarta.apache.org>
--
To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>