Topic
  • 1 reply
  • Latest Post - ‏2009-06-02T23:14:30Z by Wes_Clark
Wes_Clark
Wes_Clark
5 Posts

Pinned topic Calling SQLServerDataSource method through WSJdbcDataSource

‏2009-06-02T23:13:16Z |
I have created a WAS 7.0 data source using the Microsoft 2.0 JDBC driver. The connection pool is working. I need to call the getSendStringParametersAsUnicode() method on the SQLServerDataSource object wrapped by the pool to confirm this parameter is set correctly. From within my applet code:

final Class<?> wsCallHelper = Class.forName("com.ibm.websphere.rsadapter.WSCallHelper");
final Method jdbcCallMethod = wsCallHelper.getDeclaredMethod("jdbcCall", Class.class, Object.class, String.class,
Objecthttp://].class, Class[.class);
boolean parametersAsUnicode = (Boolean) jdbcCallMethod.invoke(null,
SQLServerDataSource.class,
_dataSource,
"getSendStringParametersAsUnicode",
(Object[]) null,
(Class[]) null);
System.out.println("parametersAsUnicode: " + parametersAsUnicode);
if (usingUnicode && !parametersAsUnicode || !usingUnicode && parametersAsUnicode) {
throw new DBException(PLDisplayKeys.Java_Database_DBException_InvalidSendParametersAsUnicode,
Boolean.toString(parametersAsUnicode));
}
} catch (Exception e) {
...
}

After finally getting this code working, now I get:

5/24/09 8:31:17:924 PDT 0000000a SystemErr R Caused by: java.sql.SQLException: DSRA9122E: class com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource does not wrap any objects of type class com.microsoft.sqlserver.jdbc.SQLServerDataSource.
5/24/09 8:31:17:924 PDT 0000000a SystemErr R at com.ibm.ws.rsadapter.jdbc.WSJdbcUtil.call(WSJdbcUtil.java:241)
5/24/09 8:31:17:924 PDT 0000000a SystemErr R at com.ibm.websphere.rsadapter.WSCallHelper.jdbcCall(WSCallHelper.java:297)

This is the same error I got when I tried to call the unwrap() method on the DataSource returned by the JNDI call. I'm out of thinghs to try to get this to work. How can I check the state of the SendStringParameterAsUnicode on the SQL Server data source from within my application after getting a reference to the data source?
Updated on 2009-06-02T23:14:30Z at 2009-06-02T23:14:30Z by Wes_Clark
  • Wes_Clark
    Wes_Clark
    5 Posts

    Re: Calling SQLServerDataSource method through WSJdbcDataSource

    ‏2009-06-02T23:14:30Z  
    I found the solution to this problem. I needed to code it passing the actual class being used, SQLServerConnectionPoolDataSource, not the interface for the class.