• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic