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 '20, 06:14

salwa's gravatar image

salwa
25557
accept rate: 0%

edited 22 Jan '20, 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 '20, 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 '20, 11:28) salwa
Replies hidden

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

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

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 '20, 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 '20, 04:07) Volker Barth

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 '20, 04:04

Volker%20Barth's gravatar image

Volker Barth
39.2k353535805
accept rate: 34%

edited 23 Jan '20, 04:06

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
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:

×142

question asked: 22 Jan '20, 06:14

question was seen: 1,426 times

last updated: 23 Jan '20, 06:12