SQL and TimeField view

Hi,
I encountered a problem in viewing a Time field.
What have I done:
I’ve created a table in Microsoft SQL Server like this:

CREATE TABLE [dbo].[Tab01](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Nome] [nvarchar](50) NOT NULL,
	[OraInizio] [time](7) NOT NULL,
	[OraFine] [time](7) NOT NULL,
 CONSTRAINT [PK_Tab01] PRIMARY KEY CLUSTERED 
(
	[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

The table contain a description and two Time fields:

ImgData

Then I created e new Cuba Project and added a new data store connected to the SQL Database.
In Browse and Edit screens the Time fields show “00:00” instead of correct time:

ImgResult

Thanks in advance.
Michele

Sample Project:

Test01.zip (80.8 KB)

I finally discovered what’s the problem.
I have a Microsoft SQL Server 2008 R2 server.
The issue occurs when I choose Microsoft SQL Server 2005 in Application Properties RdbmsStore database type.
Everything works perfectly if I choose “Microsoft SQL Server” or “Microsoft SQL Server 2012+”

I don’t know if using a different driver may impact on my application and which is the best choice.
If anyone can give me some more explanation I thank him in advance.

Hi Michele,

“Microsoft SQL Server 2005” uses JTDS as jdbc driver. JTDS doesn’t handle TIME dbtype correctly.
“Microsoft SQL Server” or “Microsoft SQL Server 2012+” use Microsoft JDBC driver, that correctly works with TIME.
It would be preferable to use “Microsoft SQL Server” connection type for Microsoft SQL Server 2008 R2 server.

1 Like