Eqbal Z wrote:
> Hi,
>
> I am trying to cast PreparedStament and ResultSet to
> OraclePreparedStatement and OracleResultSet respectively, but I get a
> ClassCast Exception.
> I am using Tomcat and oracle's jdbc driver (configured as JNDI
> resource).
> Any ideas?
>
> Thanks.
That's because you didn't follow the directions I provided earlier.
You have to cast the Connection to an OracleConnection. Here's the
relevant code:
OralceConnection conn = (OracleConnection) DriverManager.getConnection(
dbConn, username, password );
OraclePreparedStatement stmt = (OraclePreparedStatement)
conn.prepareStatement( "..." );
....
As another poster noted, make sure that you're using the correct
Oracle class for the connection pool, i.e. something like this in
your struts-config.xml:
<data-sources>
<data-source type="oracle.jdbc.pool.OracleDataSource">
<set-property property="description"
value="Oracle Data Source"/>
<set-property property="driverClass"
value="oracle.jdbc.driver.OracleDriver"/>
<set-property property="url" value="..."/>
<set-property property="user" value="..."/>
<set-property property="password" value="..."/>
</data-source>
</data-sources>
|