SQL Server 2008 DATETIME issue

Questions and answers regarding general SQL and backend databases

SQL Server 2008 DATETIME issue

Postby ajwhitlock » Mon Jan 09, 2012 10:18 pm

Hi, I've been using Servoy successfully with Postgres but I now need to start using it with SQL Server 2008 instead. The problem is that any DATETIME field I create in MSSQL is seen as a TEXT field by Servoy. Even if I create a brand new table using Servoy with only one field on it, a DATETIME field, when I "Reload tables" in Servoy the field changes to a TEXT field. If I examine the table using SQL Server Management Studio it appears as a DATETIME field correctly before and after the reload. Can anyone point me in the right direction with this problem?

I've just updated to Servoy 6.0.4 build 1227 from an earlier build of 6 but the problem remains.

Thanks in advance...
ajwhitlock
 
Posts: 4
Joined: Fri Jan 06, 2012 12:22 am

Re: SQL Server 2008 DATETIME issue

Postby patrick » Mon Jan 09, 2012 10:51 pm

That is a bug in the JTDS driver. Please try the Microsoft driver.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: SQL Server 2008 DATETIME issue

Postby martinh » Tue Jan 10, 2012 10:12 am

If you copy the jtds driver from 5.2 into the 6.0 directory, will the problem then be solved?
Martin
------------------------------------------------
Servoy Developer
Version 5.2.10/5.2.13
Java version 1.6 update 31
Database SQL Server 2008 R2
martinh
 
Posts: 857
Joined: Wed May 09, 2007 5:34 pm
Location: Belgium

Re: SQL Server 2008 DATETIME issue

Postby patrick » Tue Jan 10, 2012 10:21 am

As I said, it is a bug inside the JTDS driver, which is not developed by Servoy. SQL Server 2008 introduces a new field type Datetime2 that is not properly mapped by the driver at this time. If you use SQL Server 2008 (R2?), you should use the Microsoft driver that you need to download yourself.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: SQL Server 2008 DATETIME issue

Postby ajwhitlock » Tue Jan 10, 2012 11:37 am

Thanks, I'll give that a try. Any downside to using the Microsoft driver that I should be aware of?
ajwhitlock
 
Posts: 4
Joined: Fri Jan 06, 2012 12:22 am

Re: SQL Server 2008 DATETIME issue

Postby patrick » Tue Jan 10, 2012 4:18 pm

Not that I know of. In general I'd say the JTDS driver is faster, so as soon as that is fixed, I'd change back.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: SQL Server 2008 DATETIME issue

Postby ajwhitlock » Wed Jan 11, 2012 11:20 pm

I've switched to the Microsoft driver and everything is working fine. Is the defaulting to DATETIME2 an R2 change? I've noticed that if you create a new column using SQL Server Management as DATETIME then everything works fine but columns created using Servoy become DATETIME2. If this has been the case since the release of 2008 then it looks like the JTDS driver is quite out-of-date.

Other than SQL syntax differences between Postgres and Server 2008, is there anything else I need to consider when moving solutions between the two?

Thanks for the help...
ajwhitlock
 
Posts: 4
Joined: Fri Jan 06, 2012 12:22 am

Re: SQL Server 2008 DATETIME issue

Postby martinh » Fri Jan 13, 2012 6:49 pm

I'm not sure this is a SQL Server 2008 problem.

I use SQL Server 2008 both for Servoy 5.2 and Servoy 6.0

When adding a DATETIME column in the database using Servoy 6.0 it creates a DATETIME2 column in the database.
When adding a DATETIME column in the database using Servoy 5.2 it creates a DATETIME column in the database.

Next I copied the jtds.jar file from 5.2 Driver directory into the Servoy 6.0 Driver directory and I did the same.

And again Servoy 6.0 created a DATETIME2 column in the database using the jtds driver from 5.2

So it is not the jtds driver that makes this situation.
I guess there is also some Servoy stuff that has some influence.

Otherwise I would have the same problem in my Servoy 5.2 environment. That uses the same database and the same driver.
The only difference is the Servoy version!
Martin
------------------------------------------------
Servoy Developer
Version 5.2.10/5.2.13
Java version 1.6 update 31
Database SQL Server 2008 R2
martinh
 
Posts: 857
Joined: Wed May 09, 2007 5:34 pm
Location: Belgium

Re: SQL Server 2008 DATETIME issue

Postby rgansevles » Fri Jan 20, 2012 10:17 am

Martin,

The type used when creating a column is not depending on the driver, but on the db type and the (hibernate) dialect used.
Servoy upgraded its hibernate libs in release 6, in which the mapping for sqlserver2008 for timestamps was changed from 'datetime' to datetime2'.

Rob
Rob Gansevles
Servoy
User avatar
rgansevles
 
Posts: 1927
Joined: Wed Nov 15, 2006 6:17 pm
Location: Amersfoort, NL

Re: SQL Server 2008 DATETIME issue

Postby Andrei Costache » Fri Jan 20, 2012 11:08 am

This has just been fixed in Servoy 6.0.x and 6.1.

Regards,
Andrei
Andrei Costache
Servoy
User avatar
Andrei Costache
 
Posts: 196
Joined: Mon Sep 07, 2009 11:53 am


Return to SQL Databases

Who is online

Users browsing this forum: No registered users and 15 guests