I would like to use JBossCMP for my project, because JBossCMP implementation of EJB 2.0 seems to be great!
However, I encountered an encoding problem using JBossCMP with Microsoft SQL Server 2000 with the JDBC driver from Microsoft. When I ejbCreate() a new CMP entity using JBossCMP, I have strange symbols in my database. When I work directly via JDBC, everything is fine.
My system is:
Windows 2000 Professional
Tomcat 4.0.3 (other JVM)
Microsoft JDBC Driver
Windows 2000 Advanced Server
Microsoft SQL Server 2000 Enterprise
I suspect MS JDBC Driver is causing the problem rather than JBoss. I had the same problem using PreparedStatement/MS JDBC Driver/MS SQL Server 2000, and am still confused why that happened. It works OK now. However, I have to use NVARCHAR, not VARCHAR.
Another problem had been 'Cannot start a cloned connection while in manual transaction mode', which was solved by adding ';SelectMethod=cursor' to the connection string for the data source. Maybe there is a driver property setting that makes the encoding works ok?
Has anyone encountered the same problem with encoding? Does anyone know a workaround?
Any help is greatly appreciated!
Hi , Sergei !
The Weblogic JDBC Driver for MS SQL has a driver property setting "weblogic.codeset". Users of the Weblogic JDBC Driver for MS SQL must set up the setting for "Windows-1251 " encoding.
Does the Microsoft JDBC Driver have the same setting ?
Look into Microsoft JDBC Driver's documentation.
Hope this helps,
Did you try the weblogic.codeset? Did it REALLY work for you? Did you use VARCHAR or NVARCHAR?
I looked into the docs and found the only encoding-related property SendStringParametersAsUnicode=true|false, which is true by default. I tried false, which gave no effect.
May be there is other SQL Server JDBC driver available for free?
I have no experience with Microsoft's driver, but I do know that the OPTA2000 driver from www.inetsoftware.de handles Unicode characters correctly. You just have to use the NVARCHAR column type everywhere and make sure that the protocol in the JDBC URL is inetdae7, for example:
The inetdae7a protocol, in contrast, only stores ASCII data.
Hi , Sergei !
I'd tried this settting. It really works. It works with VARCHAR and NVARCHAR.
Hope this helps