0

I am using FREETDS between two databases Oracle and SYBASE. My Query is running on the oracle database. The Sybase DB is connect by DBLINK thru the ODBC Gateway based on freetds. The query is:

Select NAME, SURNAME, /ORT1/HAMBURG from MIKE

In that case I get the following error on the Query:

ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[FreeTDS][SQL Server]Incorrect syntax near '/'.
{42000,NativeErr = 102}
ORA-02063: preceding 3 lines from MAHRENS
28500. 00000 -  "connection from ORACLE to a non-Oracle system returned this message:"
*Cause:    The cause is explained in the forwarded message.
*Action:   See the non-Oracle system's documentation of the forwarded message.

Any help will be appreciated

Thanks Michael

nbk
  • 45,398
  • 8
  • 30
  • 47
mahrens61
  • 101
  • what exactly is /ORT1/HAMBURG a string ? – nbk Sep 29 '22 at 15:40
  • "/ORT1/HAMBURG" is a column of a table of type string. – mahrens61 Sep 30 '22 at 06:32
  • You shouldn't have such colums that also doesn't looked normalized to me replace the slashes with underline so no escaping us necessary especially the this needs also to vecesacped in XML JSON and what not – nbk Sep 30 '22 at 07:22

1 Answers1

0

Oracle uses double quotes to escape special characters and Sybase uses brackets. So you can use either:

Select NAME, SURNAME, "/ORT1/HAMBURG" from MIKE

or

Select NAME, SURNAME, [/ORT1/HAMBURG] from MIKE

Or, make an view based for the table and use that.

slaakso
  • 8,331
  • 2
  • 16
  • 27
  • Hi slaakso, this isn't working. It seems this comes from the freetds. The freetds has to escape the response from sybase. And this doesn't happened. – mahrens61 Sep 30 '22 at 06:50
  • I tried select * from Mike and i get the same error. This means the escape from the odbc gateway is not working. Right? – mahrens61 Sep 30 '22 at 07:24
  • @mahrens61 FYI, tested with FreeTDS 1.3.13 and it handled the unusual column name without problems. – slaakso Sep 30 '22 at 07:40
  • Ok, i have the version 1.3.3 in use. I will start an update. – mahrens61 Sep 30 '22 at 14:56