Bug 117800 - [FreeTDS][SQL Server]Incorrect syntax near 'Database-Name'.
Summary: [FreeTDS][SQL Server]Incorrect syntax near 'Database-Name'.
Status: RESOLVED INSUFFICIENTDATA
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
5.1.6.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-25 12:11 UTC by Tobiasz Karoń
Modified: 2022-06-23 03:48 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Error message and details. (22.83 KB, image/png)
2018-05-25 12:11 UTC, Tobiasz Karoń
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tobiasz Karoń 2018-05-25 12:11:52 UTC
Created attachment 142272 [details]
Error message and details.

I'm trying to access an MS SQL Server database from within Libreoffice Calc.

I can run queries with sqsh, but I need to find relationships between tales, and digging in the raw data doesn't seem to bring much success.

LibreOffice Base 5 connects to my database and lists the tables, but when I try to access any of them, it shows an error message:

---
The data content could not be loaded.
---
SQL Status: 42000
Error code: 102

[FreeTDS][SQL Server]Incorrect syntax near 'CITRON2015'.
---

And displays an empty table.
Comment 1 Julien Nabet 2018-05-25 14:04:40 UTC
Could you give a try to a recent LO version?
Latest ones are:
- stable branch: 5.4.7
- last branch/evolution: 6.0.4

Indeed, 5.1.X, 5.2.X, 5.3.X versions are EOL.
Comment 2 Tobiasz Karoń 2018-05-25 14:55:04 UTC
More details in a question I've posted:
https://ask.libreoffice.org/en/question/156010/help-problems-accessing-a-microsoft-sql-server-database/
Comment 3 Tobiasz Karoń 2018-05-25 14:57:27 UTC
(In reply to Julien Nabet from comment #1)
> Could you give a try to a recent LO version?
> Latest ones are:
> - stable branch: 5.4.7
> - last branch/evolution: 6.0.4
> 
> Indeed, 5.1.X, 5.2.X, 5.3.X versions are EOL.

I've tried to reproduce this with the 6.0.4 release, but I didn't get so far, as I've had another problem occur on my way:

https://bugs.documentfoundation.org/show_bug.cgi?id=117798
Comment 4 Julien Nabet 2018-05-25 17:36:50 UTC
Ok I put the other tdf on See also.

In your ask.libreoffice link, I saw you tried jdbc but didn't know what to put.
https://docs.microsoft.com/en-US/sql/connect/jdbc/building-the-connection-url?view=sql-server-2017 may help?
Comment 5 Xisco Faulí 2018-06-25 08:54:22 UTC
(In reply to Julien Nabet from comment #4)
> Ok I put the other tdf on See also.
> 
> In your ask.libreoffice link, I saw you tried jdbc but didn't know what to
> put.
> https://docs.microsoft.com/en-US/sql/connect/jdbc/building-the-connection-
> url?view=sql-server-2017 may help?

Dear Tobiasz Karoń,
Did you try what Julien is suggesting?

I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' if the issue is still present
Comment 6 QA Administrators 2019-01-11 15:22:53 UTC Comment hidden (obsolete)
Comment 7 Vegard Vesterheim 2019-02-12 07:24:47 UTC
I am running LibreOffice 6.0.7.3 on Ubuntu 18.04.01. I experience the exact same problem trying to issue queries against MS SQL servier via ODBC. LibreOffice can successfully connect to MS SQL server, and can also browse the database tables. But when trying to execute a specific SQL query I get the same error dialog as the OP.
Comment 8 Julien Nabet 2019-02-12 10:36:27 UTC
On Win7 with master sources updated some days ago + JDBC jtds driver, no problem to list, browse and query tables.

Vegard/Tobiasz: any update with 6.1.5 or brand new 6.2.0?

Tobiasz: difficult to tell if the pb may come from freeTds or LO.

Vegard: I can't succeed in defining odbc connection with Windows tool (for DB SQL Server 2012) so stuck to give a try to odbc part.
Comment 9 Vegard Vesterheim 2019-02-12 12:43:38 UTC
With my very limited Windows knowledge, I tried to enable tracing on the
MS SQL Server side using "SQL Server Profiler".

Watching the traces in "SQL Server Profiler" I first try using sqsh from
the command line. This works fine, and the SQL statement is traced as:

    select name from aboreg;

When I run the equivalent (non-working) statement within LibreOffice, I
notice that the traced statement is:

    select "name" from "aboreg";

Suspecting that the quotes may cause problems, I tried running the same
statement (with the quotes) in sqsh. This also works fine.
Comment 10 Xisco Faulí 2019-07-08 16:02:11 UTC
A new major release of LibreOffice is available since this bug was reported.
Could you please try to reproduce it with the latest version of LibreOffice
from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to
'UNCONFIRMED' if the bug is still present in the latest version.
Comment 11 Vegard Vesterheim 2019-07-15 07:51:35 UTC
I installed Version: 6.2.5.2 on Ubuntu 18.04
Build ID: 1ec314fa52f458adc18c4f025c545a4e8b22c159

The error is still present, with symptoms like before.
Comment 12 Buovjaga 2020-04-17 17:00:59 UTC
Tobiasz: can you give an update? Your bug 117798 was closed due to no activity.
Comment 13 Vegard Vesterheim 2020-11-02 10:22:35 UTC
I am now using Libreoffice version 6.0.7.3

Using ngrep to capture some network packets when running query from within Libreoffice gives the following:

  ... "Cable" FROM "TM_DB"."dbo"."Mytable" AS "
  ... Incorrect syntax near 'TM_DB'

Running a similar query directly with isql returns a similar error message:

   SQL> select "cable" from "TM_DB"."dbo"."mytable";
[37000][FreeTDS][SQL Server]Incorrect syntax near 'TM_DB'.

Removing the quotes from the query works fine in isql:
select "cable" from "TM_DB"."dbo"."mytable";

   SQL> select cable from TM_DB.dbo.mytable;

So, it seems the problem is related to the handling of quoting in SQL
statements.
Comment 14 Julien Nabet 2020-11-02 12:19:25 UTC
(In reply to Vegard Vesterheim from comment #13)
> I am now using Libreoffice version 6.0.7.3
> ...
6.0, 6.1, 6.2 and 6.3 branches are EOL
Last stable LO version is 6.4.7 and brand new one 7.0.3
Comment 15 Vegard Vesterheim 2020-11-02 14:53:04 UTC
Installed libreoffice 7.0.2 from debian buster-backports:

Same problem:

[FreeTDS][SQL Server]Incorrect syntax near 'TM_DB'. /build/libreoffice-ajS1GV/libreoffice-7.0.2/connectivity/source/drivers/odbc/OTools.cxx:357
Comment 16 Xisco Faulí 2021-11-23 11:13:25 UTC
Hello Tobiasz,
Could you please try to reproduce it with the latest version of LibreOffice from https://www.libreoffice.org/download/libreoffice-fresh/ ?
I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' if the bug is still present in the latest version.
Comment 17 QA Administrators 2022-05-23 03:37:53 UTC Comment hidden (obsolete)
Comment 18 QA Administrators 2022-06-23 03:47:57 UTC
Dear Tobiasz Karoń,

Please read this message in its entirety before proceeding.

Your bug report is being closed as INSUFFICIENTDATA due to inactivity and
a lack of information which is needed in order to accurately
reproduce and confirm the problem. We encourage you to retest
your bug against the latest release. If the issue is still
present in the latest stable release, we need the following
information (please ignore any that you've already provided):

a) Provide details of your system including your operating
   system and the latest version of LibreOffice that you have
   confirmed the bug to be present

b) Provide easy to reproduce steps – the simpler the better

c) Provide any test case(s) which will help us confirm the problem

d) Provide screenshots of the problem if you think it might help

e) Read all comments and provide any requested information

Once all of this is done, please set the bug back to UNCONFIRMED
and we will attempt to reproduce the issue. Please do not:

a) respond via email 

b) update the version field in the bug or any of the other details
   on the top section of our bug tracker

Warm Regards,
QA Team

MassPing-NeedInfo-FollowUp