Bug 42658 - ODBC SQL Server Date Error
Summary: ODBC SQL Server Date Error
Status: RESOLVED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
3.4.3 release
Hardware: x86 (IA32) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-07 01:53 UTC by mandra
Modified: 2012-07-13 06:16 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
picture of odbc connection error (11.39 KB, image/jpeg)
2011-11-07 01:53 UTC, mandra
Details
the complete picture of libre error (171.96 KB, image/jpeg)
2011-11-28 22:30 UTC, mandra
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mandra 2011-11-07 01:53:49 UTC
Created attachment 53234 [details]
picture of odbc connection error

From SQL Server ODBC can't import the date format. It said that the datetime field overflow. The format of the source date : "11/5/2011 12:00:49 AM". Already try to make the same date format but still no chance.
Comment 1 Alex Thurgood 2011-11-27 12:29:07 UTC
Hi,

Could be linked to failed assertions that have been noticed in other ODBC connections, and/or datetime string management in LO.


Alex
Comment 2 Terrence Enger 2011-11-27 21:09:00 UTC
The value you cite looks like a datetime, not a date.  Where does "11/5/2011 12:00:49 AM" come from?
Comment 3 mandra 2011-11-27 21:31:41 UTC
it's come from the logger machine which use sql server. If I use the office, it can imported sucessfully
Comment 4 Terrence Enger 2011-11-28 04:44:41 UTC
What is the datatype of the field in question?  (Yes, I am entertaining the possibility that the message in not strictly accurate.)

What operation are you performing?  Can you show us the SQL statement which provoked the message?  What is your DATEFORMAT setting?

Can you demonstrate the error on a publicly available instance of SQL Server?
Comment 5 mandra 2011-11-28 22:30:51 UTC
Created attachment 53927 [details]
the complete picture of libre error

the complete picture of libre error
Comment 6 mandra 2011-11-28 22:31:57 UTC
The data source type is timestamp. The problem is when I try to connect to one of it's database, it shown the problem that the "datetime field overflow". Here is the step :
1. I define the new database by connecting to the existing odbc and save the connection. Until this step still have no problem.
2. Open the libre office calc and view the data source, and click the database connection that already defined. Until this step still shown no problem.
3. When I click in one of the table inside, the error shown as attached before.

I still don't have any activities for those table, just click on it and the error is appear. For the picture you can see at attached file.
Comment 7 Lionel Elie Mamane 2011-11-28 23:15:28 UTC
Could you check with a daily build of 3.5 (master)? I have the impression this is maybe bug 34309 and I'm not sure we backported that fix to 3.4.x.

Daily builds are at http://dev-builds.libreoffice.org/daily/
Comment 8 Terrence Enger 2011-11-29 06:19:17 UTC
mandra,

Thank you for the additional information.  It helps me understand what you are seeing.

What happens, I wonder, if you query the ODBC datasource from an SQL command-line front end?  MS Office--I remember you wrote that it retrieves data successfully--does not have to go through ODBC, and thus its success does not tell us that the ODBC driver can handle the data.  The SQL Server client tools include a command-line front end, but I do not know how to make it connect to the ODBC datasource.  In its simplest invocation, it too would retrieve data more directly than through ODBC.

Do your ODBC facilities offer the option of collecting a log of the session?  It may be an option in the driver manager.  (Of course, the log should not show your password, but check anyway before you publish it, eh?)


Lionel,

The text of the message looks like it comes from the ODBC driver.  So, I think that the data cannot have reached the code fixed for bug 34309.  (The message says "overflow", and arithmetic overflow was the cause of the apparent randomness of the errors reported in that bug, but still ...)


Terry.
Comment 9 Lionel Elie Mamane 2011-11-29 08:15:25 UTC
(In reply to comment #8)

> The text of the message looks like it comes from the ODBC driver.  So, I think
> that the data cannot have reached the code fixed for bug 34309.

Ah yes, good point.
Comment 10 Lionel Elie Mamane 2011-11-29 08:30:32 UTC
(In reply to comment #6)
> The data source type is timestamp.

You *sure*? I notice on http://msdn.microsoft.com/en-us/library/ms182776.aspx:

 The rowversion data type is just an incrementing number and does not preserve a date or a time. To record a date or time, use a datetime2 data type.

 timestamp is the synonym for the rowversion data type (...).

 The Transact-SQL timestamp data type is different from the timestamp data type defined in the ISO standard.

 A nonnullable rowversion column is semantically equivalent to a binary(8) column. A nullable rowversion column is semantically equivalent to a varbinary(8) column.

So this datatype does *not* contain a date&time...

In my testing (with LibO 3.4.4 and SQL Server ODBC driver 6.01.7601.17514), a column with timestamp type is not shown, but still imports into Calc with value "#N/A" everywhere.

Please show us the output of SQL command:

 SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_CATALOG='master' AND TABLE_SCHEMA='dbo' AND TABLE_NAME='DATA_H1_ASB';
Comment 11 mandra 2011-12-01 22:28:37 UTC
Hi Lionel,

The data type of timestamp field is datetime, I already download for the daily update of libreoffice 3.5. For the first problem is already solved. But when I try to coneect it with calc application, it crashed when I drag the data from data source to spreadsheet cell. When I drag it, always says that the soffice.bin error and show some don't send confirmation report.

Thanks for concern about my problem.
Comment 12 Lionel Elie Mamane 2011-12-03 14:51:56 UTC
This could be a truncation issue; see http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/ac1b5a6d-5e64-4603-9c92-b75ba4e51bf2/

mandra, could you please give us the *exact* details, because I can't reproduce your problem. For me, access to datetime columns works.

 * the type of the column is datetime and not datetime2?

 * what is the scale of the column

 * please show us the output of query:

   SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_CATALOG='master' AND
   TABLE_SCHEMA='dbo' AND TABLE_NAME='DATA_H1_ASB';

 * could you attach a database dump of a small, minimal, database that has the problem?

 * What version of SQL Server? What version of the ODBC driver?
Comment 13 Lionel Elie Mamane 2012-07-13 06:16:39 UTC
No news from reporter for several months -> closing.

Works for me, but possibly with different versions of SQL Server, ODBC driver, different column type (or scale), ...

Anyone reproducing this bug, feel free to reopen *and* provide the needed details, that is:

 * the type of the column: timestamp, datetime, datetime2?

 * what is the scale of the column

 * output of query:

   SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_CATALOG='master' AND
   TABLE_SCHEMA='dbo' AND TABLE_NAME='DATA_H1_ASB';

   (replacing 'master', 'dbo', 'DATA_H1_ASB' by the values for the table
   where you encounter the problem)

 * attach a database dump of a small, minimal, database
   that has the problem?

 * What version of SQL Server? What version of the ODBC driver?