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! |
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)". Comment Text Removed
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 '20, 06:11)
Volker Barth
|
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.
thanks for the answer in windows system i have no problem but in linux and docker i get this error: Database server not found
Try to use the DBLOCATE tool or add LOG=... to the connection string for further diagnosis.
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.
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.