Hi Alex


I haven’t any experience with AS400, but usually use pyodbc to connect to a 
MS SQL Server. 


Trying to help, I suggest the following steps:


   1. Verify you ODBC DSN is defined in the same CPU word length of Python 
   (Python 2.7 (32 bits) uses ODBC Data Sources (32 bits), and Python 2.7 (64 
   bits) uses ODBC Data Sources (64 bits)). I was stuck a full day before 
   figuring out this issue;
   2. Test your ODBC DSN connectivity, either withthe DSN definition dialog 
   or using ACCESS or EXCEL to test. Which you will be more comfortable;
   3. Try to use the “Pass through exact Pyodbc string” when creating the 
   engine as stated in SQLAlchemy documentation 
    (http://docs.sqlalchemy.org/en/latest/dialects/mssql.html
   http://docs.sqlalchemy.org/en/latest/dialects/mssql.html), and use an 
   ODBC connection string (http://mkleehammer.github.io/pyodbc/), and you 
   can get some insight with “Connection Strings” site information (
   http://www.connectionstrings.com/dsn/);

 

I think something like this, maybe work:
import urllib
params = urllib.quote_plus("DSN=myDsn;Uid=myUsername;Pwd=myPassword;") 

engine = create_engine("ibm_db_sa+pyodbc:///?odbc_connect=%s" % params, echo
=True)


 

*NOTE*: The “echo=True” directs SQLAlchemy to display the SQL statements it 
uses

 

Hope to be any help,

Alexandre

sexta-feira, 12 de Fevereiro de 2016 às 15:05:18 UTC, Alex Hall escreveu:
>
> Hello list, 
> I've configured a DSN to a test version of my work's AS400 and I seem 
> to be able to connect just fine (Yes!) I'm now running into a problem 
> when I try to ask for a list of all tables. The line is: 
>
>  dbInspector = inspect(dbEngine) 
>
> The traceback is very long, and I can paste it if you want, but it 
> ends with this: 
>
> AttributeError: 'pyodbc.Connection' object has no attribute 'dbms_ver' 
>
> I'm unable to find anything about this online, so thought I'd check 
> with this list. Here's my connection: 
>
> dbEngine = create_engine("ibm_db_sa+pyodbc://user:pwd@myDSN") 
>
> If anyone knows what is causing this, I'd appreciate your thoughts. 
> I've installed pyodbc, ibm_db, and ibm_db_sa through pip, so I should 
> have all the latest versions of everything. I'm on Windows 7x64, 
> Python 2.7 (latest). 
>

-- 
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 post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to