| Author |
MS SQL Server and alue can not be converted to requested type
|
Jari Timonen
Ranch Hand
Joined: Jan 16, 2004
Posts: 230
|
|
Hello. I'm using Jboss 3.2.3, Microsoft SQL Server 2000 and Microsoft JDBC driver (SP2). I'm using CMP Beans. I'm getting this very wierd error: If I use HypersoniqSQL everything works fine! Anyone?
|
SCJP 5.0, SCJD URLyBird 1.3.3, OCMJEA 5 (SCEA) Factory Homes
|
 |
Dmitry Melnik
Ranch Hand
Joined: Dec 18, 2003
Posts: 328
|
|
Are you using the similar db schemas with MS SQL and HypersoniqSQL? Check your in code if you insert/update with string values the columns of types other than varchar/char (like dates, numbets, etc). The conversion of strings to other types might work differently on different kinds of DB servers.
|
 |
Jari Timonen
Ranch Hand
Joined: Jan 16, 2004
Posts: 230
|
|
I use Xdoclet, so everything is same. I'm only changing datasource.
|
 |
Dmitry Melnik
Ranch Hand
Joined: Dec 18, 2003
Posts: 328
|
|
I use Xdoclet, so everything is same. OK, you use XDcolet to generate the DB schema, right? Back to my point. Lets assume I have a table Table1 which has a column date1 of type "datetime" (or similar). If I execute a piece of code like this: It might work on certain SQL servers (configured in a certain ways), and it might not work on others (or even the same one but configured differently). And the result depends on the ability of the server to convert the string to the targer data type. If I use the following code, it will work more often: My suggestion was to make sure that your code did not do the thing my first example did.
|
 |
Jari Timonen
Ranch Hand
Joined: Jan 16, 2004
Posts: 230
|
|
Thank you for tip. But, i'm using EJB CMP. I'm making simple RMI call using ServiceLocator (J2EE Design pattern). Then i'm simply askin value from CMP Bean.
|
 |
 |
|
|
subject: MS SQL Server and alue can not be converted to requested type
|
|
|