Cross posted in SQL Server Data Access forum at
http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/7a017a82-03d2
-483f-a1da-fdc0402acae0.
Wes Clark - 30 May 2009 06:17 GMT
I got it to work: Either using the officially WAS 7.0.0.3 supported MS 1.2
JDBC driver, or the not-yet-supported 2.0 MS JDBC driver, this approach
works. The Java code I am using is
final Class<?> wsCallHelper =
Class.forName("com.ibm.websphere.rsadapter.WSCallHelper");
final Method jdbcCallMethod =
wsCallHelper.getDeclaredMethod("jdbcCall", Class.class, Object.class,
String.class,
Object[].class, Class[].class);
boolean parametersAsUnicode = (Boolean) jdbcCallMethod.invoke(null,
SQLServerConnectionPoolDataSource.class,
_dataSource,
"getSendStringParametersAsUnicode",
(Object[]) null,
(Class[]) null);
This code correctly returns the value of the SendStringParametersAsUnicode
datasource property.
I don't think WAS is yet supporting the unwrap method on the DataSource.
> Cross posted in SQL Server Data Access forum at
> http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/7a017a82-03d2
-483f-a1da-fdc0402acae0.
Wes Clark - 25 Jun 2009 17:29 GMT
On May 29, 10:17 pm, Wes Clark <WesCl...@discussions.microsoft.com>
wrote:
> I got it to work: Either using the officially WAS 7.0.0.3 supported MS 1.2
> JDBC driver, or the not-yet-supported 2.0 MS JDBC driver, this approach
[quoted text clipped - 20 lines]
> > Cross posted in SQL Server Data Access forum at
> >http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/7a....
Just FYI, IBM says WAS 7.0 should support the Wrapper interface
methods in JDBC 4.0 and the MS 2.0 driver, so I have an open PMR to
resolve this.
Posted on developerWorks > WebSphere > Forums > IBM WebSphere Portlet Factory
- Databases and Data Sources >
(https://www.ibm.com/developerworks/forums/thread.jspa?threadID=263671)
Calling SQLServerDataSource method through WSJdbcDataSource
Posted: May 24, 2009 09:06:47 PM. 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?
> Our ISV application supports using SQL Server with either single byte varchar
> columns, or all nvarchar columns. We support an internal connection pool
[quoted text clipped - 19 lines]
> SendStringParametersAsUnicode in a third-party datasource constructed with
> the Microsoft 2.0 JDBC driver?
Wes Clark - 02 Jul 2009 17:51 GMT
IBM said trying to unwrap a WebSphere DataSource to the underlying
SQLServerDataSource doesn't work because SQLServerDataSource is not an
interface, as specified by the JDBC 4.0 Wrapper JavaDoc for the unwrap
method. Does Microsoft have plans to provide an "unwrappable" interface to
the SQLServerDataSource so a third party application server DataSource
returned from the JNDI lookup can be unwrapped to allow access to the
SQLServerDataSource methods, such as checking properties such as
SendStringParametersAsUnicode?
I would appreciate a reply from the Microsoft JDBC developer team. Thanks.
> Posted on developerWorks > WebSphere > Forums > IBM WebSphere Portlet Factory
> - Databases and Data Sources >
[quoted text clipped - 70 lines]
> > SendStringParametersAsUnicode in a third-party datasource constructed with
> > the Microsoft 2.0 JDBC driver?