I installed odbc driver in linux and in docker with local server I have no problem but I couldn't connect to remote server in the container

When I run container I get the error.

pyodbc.OperationalError: ('08001', '[08001] [unixODBC] [SAP] [ODBC Driver] [SQL Anywhere] Database server not found (-100) (SQLDriverConnect)')

connect is with sqlalchemy

connectionString = Driver = {/ opt / sqlanywhere17 / lib64 / libdbodbc17.so}: SERVER = server: HOST = 160.112.23.175: PORT = 18000: UID = user11: PWD = user11sql

quoted = quote_plus(connectionString)

new_con = 'sybase+pyodbc:///?odbc_connect={}'.format(quoted)

engine = create__engine(new_con)

I really don't know what to do, I've been going round in circles with this for over a day now. Some help would be greatly appreciated!

asked 22 Jan, 06:14

salwa's gravatar image

salwa
25126
accept rate: 0%

edited 22 Jan, 06:32

1

Show us the code that started the SQL Anywhere database.

Your code "SERVER = server" may not be correct unless you used "dbsrv17 -n server mydatabase.db".

If you used "dbsrv17 mydatabase.db" then the connection string should read "SERVER = mydatabase" because when you omit the "-n servername" option, the server name defaults to be the same as the database name.

(22 Jan, 09:30) Breck Carter

thanks for the answer in windows system i have no problem but in linux and docker i get this error: Database server not found

(22 Jan, 11:28) salwa
Replies hidden

Try to use the DBLOCATE tool or add LOG=... to the connection string for further diagnosis.

(22 Jan, 12:12) Volker Barth
Comment Text Removed

thanks, I have already added to the connection string LOG=... and i have this message

TCPIP-Verbindung wird versucht (keine im Cache sasrv.ini gespeicherte Adresse)
 Server mit dem Namen kakomm wird gesucht
 Server wird an der Adresse 160.112.23.175:2638 gesucht
 TCP/IP-Verbindung, Funktion connect(), Fehlercode 111
 Ein HOST-Wert wurde angegeben, LDAP-Prüfung wird übersprungen
 Broadcast zur Suche nach Servern verwenden
 Broadcastadresse 160.112.23.175:2638 wird verwendet
 Erneute Sendung
 Erneute Sendung
 Erneute Sendung
 Erneute Sendung
 Server nicht gefunden (keine Antwort erhalten)
 Verbindung über TCPIP fehlgeschlagen
 Fehlgeschlagene Adresse wird aus dem Cache sasrv.ini entfernt Es wird nicht versucht, einen Server automatisch zu starten
 Verbindung mit dem Server nicht möglich
(23 Jan, 02:42) salwa
Replies hidden

So does the database server at the specified host is named "kakomm"? In other words, when you connect locally to the server (which is successful as you tell in the question), what does "select property('Name')" return?

I suspect that the database server name is not "kakomm" and therefore the client cannot connect.

FWIW, when connecting via the HOST name, the server name is basically optional unless you use High Availability so you might you omit it. But you might need to add the database name (DBN) unless the database server just runs one single database.

(23 Jan, 04:00) Volker Barth

Forget my comment above, your log shows that the server is searched at the default port 2638 so your client does not successfully specify the desired port 18000. See my answer.

(23 Jan, 04:07) Volker Barth
showing 3 of 6 show all flat view

I guess you specified HOST and PORT in an inappropriate manner, the syntax for the HOST connection parameter with specified port is

HOST = 160.112.23.175:18000

there is no separate PORT connection parameter.

AFAIK, "PORT=" is only supported when not using the HOST connection parameter but using the LINKS connection parameter which has a PORT protocol option as part of the network options, i.e. "LINKS=TCPIP(HOST=160.112.23.175;PORT=18000)".

permanent link

answered 23 Jan, 04:04

Volker%20Barth's gravatar image

Volker Barth
36.1k342501749
accept rate: 34%

edited 23 Jan, 04:06

thank you very much Volker

i add to the connectstring

LINKS=TCPIP(HOST=160.112.23.175;PORT=18000)

the server is now run without problems

TCPIP-Verbindung wird versucht (keine im Cache sasrv.ini gespeicherte Adresse)
 Server mit dem Namen kakomm wird gesucht
 Server wird an der Adresse 160.112.23.175:18000 gesucht
 Server gefunden, Servername wird überprüft
 Datenbankserver kakomm auf Verbindung TCPIP gefunden
 Verbunden unter Verwendung von Clientadresse 160.112.23.130:60392
 Verbunden mit Server über TCPIP
 Serveradresse 160.112.23.175:18000 wird in den Cache sasrv.ini geschrieben
 Verbunden mit SQL Anywhere Server Version 17.0.9.4803
 Hinweise zur Anwendung:
(23 Jan, 05:15) salwa
Replies hidden

Hm, I still would recommend to omit the LINKS parameter and just use "HOST= 60.112.23.175:18000" in your original connection string.

FWIW, if the issue is solved, fell free to check the answer as "accepted" via the according check mark :)

(23 Jan, 06:11) Volker Barth
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×137

question asked: 22 Jan, 06:14

question was seen: 197 times

last updated: 23 Jan, 06:12