Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MS SQL Server and alue can not be converted to requested type

 
Jari Timonen
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Dmitry Melnik
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I use Xdoclet, so everything is same.
I'm only changing datasource.
 
Dmitry Melnik
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic