cancel
Showing results for 
Search instead for 
Did you mean: 

Connection to SQL Anywhere 11 using Python 3.9.0

0 Kudos
796

In this work, I want to connect my Python 3.9.0 to SQL Anywhere 11. I use a module that I got from this github repository. I want to ask about a line of code in this github repository that I found.

conn = sqlanydb.connect(uid='dba', pwd='sql', eng='demo', dbn='demo' )

What is the meaning of the eng parameter and dbn parameter statements? How do I find the identity of the parameter in my SQL Anywhere? Thank you

Accepted Solutions (0)

Answers (1)

Answers (1)

chris_keating
Product and Topic Expert
Product and Topic Expert

Note that SQL Anywhere 11 reached EOMM 31.05.2014.

Here is the basics of connections

dbeng11 -n <eng_name> Database1.db -n <database_name> Database2.db -n <database_name>

The first -n in a database server startup command is the engine (or server name) and the subsequent -n(s) following a database file is the database name. Note: You can run multiple databases on the same engine.

conn = sqlanydb.connect(uid='dba', pwd='sql', eng='<engine_name>', dbn='<database_name>' )

In the absence of -n, the server will be named the same as the first database started. The database name would be the database file name without path and extension.

dbeng11 Database1.db

The engine is Database1 and the database name is Database1. If the database is named as in:

dbeng11 Database1.db -n MyFirstDatabase

the engine name would be the same as the database name or MyFirstDatabase.

Please refer to the SQL Anywhere Server Database Administration book and specifically the Starting and Connecting to your Database for additional information.

0 Kudos

Beside of basic connections, did you know how to check the engine from ODBC Data Source ( 64-bit ) ? Becasue in my basic connections to the Data base, the command is like,

dbeng11 -c<parameter> D:\\<to database="" path="">\\database.db there is no "-n" in there.

chris_keating
Product and Topic Expert
Product and Topic Expert
0 Kudos

I do not have ready access to a SQLA 11 DSN. If you are supplying the database file in the DSN, it is being configured to autostart. It is still best practice to provide an engine name and database name. If all that you have is the credentials and database file, the engine name would be the database name and the database name would be the db file name without the .db extension. lets assume that the database file is MyDatabase.db so the database name would be MyDatabase and the engine name would be MyDatabase. All of this is covered in detail in the documentation that I suggested. Here is a link to SyBooks whihc has SQL Anywhere 11 documentation: https://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.sqlanywhere.11.0.1/dbadmin_en11/...

0 Kudos

Ok, thank you for your answer and information

VolkerBarth
Contributor
0 Kudos

FWIF, the SQL Anywhere 11 help is also available on the SAP Help Portal as a bunch of PDF files:

https://help.sap.com/docs/SAP_SQL_Anywhere?version=11.00.0&locale=en-US