Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

I am trying to connect to a SQL Anywhere 17 Database from Python using pyodbc Module.

The connect looks like: mydb=pyodbc.connect('DSN=mydsn;UID=dba;pwd=mypwd;Company=mycompany;Application=myapp;Signature=mysignature')

The database runs as a service (dbsvc), and the connection works only if the the database doesnt have other connections open. i.e. if I connect to the database using dbisql then has my Python script no any chance to connect to the DB and I get the following error:

Unable to initialize performance monitor data area; server startup continuing
SQL Anywhere Personal Server Version
Developer edition, not licensed for deployment.
Copyright © 2018 SAP SE or an SAP affiliate company.
All rights reserved.
Use of this software is governed by the SAP Software Use Rights Agreement.
Refer to
Connection limit (Personal Server): 10
Processors detected: 8 logical processor(s) on 4 core(s) on 1 physical processor(s)
Processor license restriction (Personal Server): all logical processors on at most 4 core(s) on at most 1 physical processor(s)
This server is licensed to use: all logical processors on at most 4 core(s) on at most 1 physical processor(s)
Processors in use by server: 8 logical processor(s) on 4 core(s) on 1 physical processor(s)
This server is licensed to:
    Developer Edition
    Restricted Use
Running Windows 10 Build 19043  on X86_64
Server built for X86_64 processor architecture
51464K of memory used for caching
Minimum cache size: 51452K, maximum cache size: 7453104K
Using a maximum page size of 2048 bytes
Multiprogramming level: 20
Database server shutdown due to startup error
Database server stopped at Wed Apr 20 2022 16:08

asked 20 Apr '22, 10:09

Baron's gravatar image

accept rate: 48%

edited 20 Apr '22, 10:09

If you specify a DSN, do the DSN's connection parameters conflict with the running database, say, you are trying to explicitly start a database file that is already running - possibly with a different name? You might use a DSN-less connection string, see your older question here.

To add: Do you use the -oe server option to log startup errors in a different message log? If so, what does that tell?

(20 Apr '22, 11:01) Volker Barth

I can't use DSN-less connection, since the servername varies among devices, and only the DSN name is fix.

BTW, the other connection (over dbisql) uses also same DSN, so there might not be any chance for a conflict.

(21 Apr '22, 03:15) Baron
Replies hidden

Well, so what's in the DSN? And what kind of DSN is this - system or user?

Note that system DSNs with the same name are not shared between 32-bit and 64-bit. May this have an effect here (in case you are using a 64-bit DBISQL and a 32-bit Python process or vice versa)?

(21 Apr '22, 03:27) Volker Barth

Are you connecting to an already running database server? The engine log posted appears to be suggesting that the database server is being autostarted. It is attempting to start a personal server (dbengX). And, there is already an engine running as indicated by the first line of the engine log.

Adding LOG= to the connection string will log connection diagnostic info and include the actual connection string that is used for connecting (logged as "Attempting to connect using:". Please note that the following "Company=mycompany;Application=myapp;Signature=mysignature" is not valid connection parms.

Here is an example connection with LOG:

mydb=pyodbc.connect('DSN=mydsn;UID=dba;pwd=mypwd;log=<path>\filename' )

I would also run the server with -z to collect server side communication logging i.e., it will log connection attempts.

My guess is that the database server name and database name defined in the DSN do not match the running database server and then it attempts to start a database server and is unable. The client and server communication diagnostic logs will collect the information that will identify the cause.

(21 Apr '22, 08:18) Chris Keating
Replies hidden

I also recommend that you include Server=xxx in your connection string or data source specifying the server name. I find that omitting it prevents connecting to a personal server running as a service.

(21 Apr '22, 14:10) JBSchueler

Is there any documentation how the connection string should look like?

Please note that the following "Company=mycompany;Application=myapp;Signature=mysignature" is not valid connection parms.

where should I then define my authentication string?

(22 Apr '22, 05:59) Baron
Replies hidden

If you cannot set the connection_authentication option via code, it has to be specified via the InitString connection parameter, see the OLEDB sample here.

(22 Apr '22, 06:56) Volker Barth
showing 5 of 8 show all flat view
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

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



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "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:


question asked: 20 Apr '22, 10:09

question was seen: 895 times

last updated: 22 Apr '22, 08:10