On 09/20/2011 09:12 AM, Alan Wright wrote:
> I am migrating from 2 to 4.00.22
>
> We make use of OraclePreparedStatement to take advantage of setting 
> parameters by name.

You should use the JDBC unwrap() method (which is newer than Resin 2):

   PreparedStatement pStmt = conn.prepareStatement(sql);
   OraclePreparedStatement ps = pStmt.unwrap(OraclePreparedStatement.class);

-- Scott

> This worked fine under Resin 2.
>
>
>
> We get the datasource
>
>         try {
>
>              Context env = (Context) new 
> InitialContext().lookup(Constants.CONTEXT_ENV_ROOT);
>              ds = (DataSource) env.lookup(Constants.GENERAL_CONNECTION_POOL);
>              if (ds == null) {
>                  System.out.println(Constants.GENERAL_CONNECTION_POOL + " is 
> an unknown DataSource");
>              }
>
>          } catch (NamingException e) {
>              e.printStackTrace();
>          }
>
>
>
> and then in another class we use it:
>
>
>           Connection con = null;
>           list = new java.util.ArrayList();
>
>           try {
>
>               con = ds.getConnection();
>               OraclePreparedStatement ps = (OraclePreparedStatement) 
> con.prepareStatement(getSQLCommandText());
>               etc......
>
>
>
>
> BUT under resin 4 we are getting errors that we cannot cast the 
> com.caucho.sql.UserPreparedStatement to OraclePreparedStatement.
>
> Do we really have to abandon OraclePreparedStatement and named parameters?
>
> I have tried casting the connection and such like but the caucho.sql.UserXXXX 
> seems to take over everything.
>
>
>
> Any help or pointers would be welcome.
>
>
> Thanks
>
>
>
> Alan
>
>
>
>
>
>
>
>



_______________________________________________
resin-interest mailing list
resin-interest@caucho.com
http://maillist.caucho.com/mailman/listinfo/resin-interest

Reply via email to