Hello Gord Thompson,
Yeah i found this dialect documentation and its working with the pyodbc 
connection. and my query works with pd.read_sql() but i want to test it 
with sqlalchemy cause im getting an warning that i should use sqlalchemy. 
But thats what i wanted to do. 

cnxn = pyodbc.connect('DRIVER={Adaptive Server Anywhere 
7.0};Commlinks=tcpip{ip=*MyIpAdresse*;Port=*MyPort*};ENG=*MyDBName*;UID=
*MyUserID*;PWD=*MyPassword*')

this works fine but atm cant handle to connect my db with sqlalchemy:

engine = create_engine('DRIVER={Adaptive Server Anywhere 
7.0};Commlinks=tcpip{ip=*IP*;Port=*Port*};ENG=*Database*;UID=*ID*;PWD=
*Password*')
cnxn = engine.connect()

Error:
Traceback (most recent call last):
File "<string>", line 2, in create_engine
  File 
"C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\sqlalchemy\util\deprecations.py",
 
line 309, in warned
    return fn(*args, **kwargs)
  File 
"C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\sqlalchemy\engine\create.py",
 
line 530, in create_engine
    u = _url.make_url(url)
  File 
"C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\sqlalchemy\engine\url.py",
 
line 731, in make_url
    return _parse_rfc1738_args(name_or_url)
  File 
"C:\Users\User\AppData\Local\Programs\Python\Python39-32\lib\site-packages\sqlalchemy\engine\url.py",
 
line 792, in _parse_rfc1738_args
    raise exc.ArgumentError(
sqlalchemy.exc.ArgumentError: Could not parse rfc1738 URL from string 
'DRIVER={Adaptive Server Anywhere 7.0};Commlinks=tcpip{ip=*IP*;Port=*Port*
};ENG=*Database*;UID=*ID*;PWD=*Password*'

Thanks in advance

Gord Thompson schrieb am Donnerstag, 21. April 2022 um 14:37:00 UTC+2:

> Perhaps this might help:
>
> https://www.connectionstrings.com/asa-odbc/
>
> Note also that the sqlalchemy-sybase dialect has not been tested with the 
> "Adaptive Server Anywhere" driver. If its behaviour differs significantly 
> from the "SAP ASE ODBC driver" then you may have issues with that.
>
> On Thursday, April 21, 2022 at 6:29:19 AM UTC-6 Gord Thompson wrote:
>
>> > Verbindung mit dem Datenbankserver unmöglich: Datenbankserver läuft 
>> nicht
>>
>> "Unable to connect to database server: Database server is not running"
>>
>> > Ungültiges Attribut für Verbindungszeichenfolge
>>
>> "Invalid connection string attribute"
>>
>> Check the documentation for your ODBC driver to verify that you are using 
>> the correct attribute names in your connection string.
>>
>> On Thursday, April 21, 2022 at 2:21:36 AM UTC-6 Trainer Go wrote:
>>
>>> Now im getting this error:
>>>
>>> pyodbc.OperationalError: ('08001', '[08001] [Sybase][ODBC 
>>> Driver][Adaptive Server Anywhere]Verbindung mit dem Datenbankserver 
>>> unmöglich: Datenbankserver läuft nicht (-100) (SQLDriverConnect); [08001] 
>>> [Sybase][ODBC Driver]Ungültiges Attribut für Verbindungszeichenfolge (0); 
>>> [08001] [Sybase][ODBC Driver]Ungültiges Attribut für 
>>> Verbindungszeichenfolge (0); [08001] [Sybase][ODBC Driver]Ungültiges 
>>> Attribut für Verbindungszeichenfolge (0); [08001] [Sybase][ODBC 
>>> Driver]Ungültiges Attribut für Verbindungszeichenfolge (0); [08001] 
>>> [Sybase][ODBC Driver]Ungültiges Attribut für Verbindungszeichenfolge (0)')
>>>
>>> Maybe a problem with my Connection String?
>>>
>>> connection_string = (
>>>     "DRIVER=Adaptive Server Anywhere 7.0;"
>>>     "SERVER=IP;"
>>>     "PORT=Port;"
>>>     "UID=ID;PWD=password;"
>>>     "DATABASE=NameOfDB;"
>>>
>>>     "charset=utf8;"
>>> )
>>> connection_url = URL.create(
>>>     "sybase+pyodbc", 
>>>     query={"odbc_connect": connection_string}
>>> )
>>> engine = create_engine(connection_url)
>>>
>>>
>>>
>>> Gord Thompson schrieb am Mittwoch, 20. April 2022 um 17:18:08 UTC+2:
>>>
>>>> Yes, that's correct. If you are running 64-bit Python then you need to 
>>>> have a 64-bit version of the ODBC driver installed. 64-bit applications 
>>>> cannot use 32-bit drivers.
>>>>
>>>> On Wednesday, April 20, 2022 at 2:21:32 AM UTC-6 Trainer Go wrote:
>>>>
>>>>> Hi Gord Thompson,
>>>>>
>>>>> with print pyodbc.drivers() result = ['SQL Server', 'Microsoft Access 
>>>>> Driver (*.mdb, *.accdb)', 'Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, 
>>>>> *.xlsb)', 'Microsoft Access Text Driver (*.txt, *.csv)']
>>>>>
>>>>> but i think i know why i have problems with the connection. Cause i 
>>>>> tried to connect with my 64 Bit Python programm a 32 Bit driver and the 
>>>>> 32 
>>>>> Bit driver isnt listed in my pyodbc print 64 Bit
>>>>>
>>>>> Gord Thompson schrieb am Donnerstag, 14. April 2022 um 18:30:44 UTC+2:
>>>>>
>>>>>> > Der Datenquellenname wurde nicht gefunden, und es wurde kein 
>>>>>> Standardtreiber angegeben
>>>>>>
>>>>>> "The data source name was not found and no default driver was 
>>>>>> specified"
>>>>>>
>>>>>> Use
>>>>>>
>>>>>> import pyodbc
>>>>>>
>>>>>> print(pyodbc.drivers())
>>>>>>
>>>>>> to view the names of the ODBC drivers that are available to your 
>>>>>> application.
>>>>>>
>>>>>> On Thursday, April 14, 2022 at 3:35:52 AM UTC-6 Trainer Go wrote:
>>>>>>
>>>>>>> i tried to connect my database but im getting an InterfaceError and 
>>>>>>> i dont know how so solve it.
>>>>>>>
>>>>>>> connection_string = (
>>>>>>>     "DRIVER=Adaptive Server Anywhere 7.0;"
>>>>>>>     "SERVER=IP;"
>>>>>>>     "PORT=Port;"
>>>>>>>     "UID=ID;PWD=PASSWORD;"
>>>>>>>     "DATABASE=NameOfDatabase;"
>>>>>>>     "charset=utf8;"
>>>>>>> )
>>>>>>> connection_url = URL.create(
>>>>>>>     "sybase+pyodbc", 
>>>>>>>     query={"odbc_connect": connection_string}
>>>>>>> )
>>>>>>> engine = create_engine(connection_url)
>>>>>>>
>>>>>>> conn = engine.connect()
>>>>>>>
>>>>>>> InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] 
>>>>>>> Der Datenquellenname wurde nicht gefunden, und es wurde kein 
>>>>>>> Standardtreiber angegeben (0) (SQLDriverConnect)')
>>>>>>> InterfaceError: (pyodbc.InterfaceError) ('IM002', '[IM002] 
>>>>>>> [Microsoft][ODBC Driver Manager] Der Datenquellenname wurde nicht 
>>>>>>> gefunden, 
>>>>>>> und es wurde kein Standardtreiber angegeben (0) (SQLDriverConnect)')
>>>>>>> (Background on this error at: http://sqlalche.me/e/14/rvf5)
>>>>>>>
>>>>>>> i have installed the driver on my computer and its called  Adaptive 
>>>>>>> Server Anywhere 7.0 so i dont know where the problem is...
>>>>>>>
>>>>>>> Jonathan Vanasco schrieb am Donnerstag, 14. April 2022 um 00:07:06 
>>>>>>> UTC+2:
>>>>>>>
>>>>>>>> The Sybase dialect was deprecated from first-party support by 
>>>>>>>> SQLAlchemy and is currently unsupported.
>>>>>>>>
>>>>>>>> Gord Thompson, who is a frequent contributor to the core SQLAlchemy 
>>>>>>>> project, and has generously taken over responsibility for the original 
>>>>>>>> dialect as a third-party dialect::
>>>>>>>>
>>>>>>>> https://github.com/gordthompson/sqlalchemy-sybase
>>>>>>>>
>>>>>>>> In addition to offering some excellent code, his repo offers a wiki 
>>>>>>>> and some documentation - both of which should help.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tuesday, April 12, 2022 at 11:10:40 AM UTC-4 Trainer Go wrote:
>>>>>>>>
>>>>>>>>> im a bit lost and need some help.
>>>>>>>>>
>>>>>>>>> im trying to set up a database connection with sqlalchemy to a 
>>>>>>>>> Sybase Adaptive Server Anywhere Version 7 and i dont know how.
>>>>>>>>>
>>>>>>>>> I would be really happy if somebody could help me.
>>>>>>>>>
>>>>>>>>> Thanks in advace.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Greetings Mae
>>>>>>>>>
>>>>>>>>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/557b2cf6-14e2-4e47-aff4-d9820bd4f894n%40googlegroups.com.

Reply via email to