Stuart Henderson wrote:
On 2009-07-16, Vijay Sankar <[email protected]> wrote:
I had sent a request for help the other day (Subject " freetds and iodbc
to access Microsoft SQL Server 2005") to m...@. (I sent my thanks
directly to everyone who tried to help but did not copy misc@ to reduce
unnecessary email messages)
It looks like I should use py-sqlalchemy which requires pyodbc.
the version of py-sqlalchemy in ports doesn't appear to need pyodbc..
Thanks very much, probably there is something fundamental that I don't
understand. If I am interpreting the error correctly, the issue seems to
be because py-sqlalchemy cannot find a DBAPI. I will read through the
ports Makefile to see if I can ask a more sensible question.
Anyways, I wiped everything out and restarted the server, installed
stuff just from packages and here is the result.
Python 2.5.4 (r254:67916, Jun 5 2009, 20:07:16)
[GCC 3.3.5 (propolice)] on openbsd4
Type "copyright", "credits" or "license()" for more information.
****************************************************************
Personal firewall software may warn about the connection IDLE
makes to its subprocess using this computer's internal loopback
interface. This connection is not visible on any external
interface and no data is sent to or received from the Internet.
****************************************************************
IDLE 1.2.4
>>> import sqlalchemy
>>> sqlalchemy.__version__
'0.5.0'
from sqlalchemy import create_engine
engine = create_engine('mssql://sa:[email protected]:1433/pmnew',
echo=True)
connection = engine.connect()
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
connection = engine.connect()
File
"/usr/local/lib/python2.5/site-packages/sqlalchemy/engine/base.py", line
1221, in connect
return self.Connection(self, **kwargs)
File
"/usr/local/lib/python2.5/site-packages/sqlalchemy/engine/base.py", line
531, in __init__
self.__connection = connection or engine.raw_connection()
File
"/usr/local/lib/python2.5/site-packages/sqlalchemy/engine/base.py", line
1276, in raw_connection
return self.pool.unique_connection()
File "/usr/local/lib/python2.5/site-packages/sqlalchemy/pool.py", line
119, in unique_connection
return _ConnectionFairy(self).checkout()
File "/usr/local/lib/python2.5/site-packages/sqlalchemy/pool.py", line
304, in __init__
rec = self._connection_record = pool.get()
File "/usr/local/lib/python2.5/site-packages/sqlalchemy/pool.py", line
161, in get
return self.do_get()
File "/usr/local/lib/python2.5/site-packages/sqlalchemy/pool.py", line
639, in do_get
con = self.create_connection()
File "/usr/local/lib/python2.5/site-packages/sqlalchemy/pool.py", line
122, in create_connection
return _ConnectionRecord(self)
File "/usr/local/lib/python2.5/site-packages/sqlalchemy/pool.py", line
198, in __init__
self.connection = self.__connect()
File "/usr/local/lib/python2.5/site-packages/sqlalchemy/pool.py", line
261, in __connect
connection = self.__pool._creator()
File
"/usr/local/lib/python2.5/site-packages/sqlalchemy/engine/strategies.py",
line 80, in connect
raise exc.DBAPIError.instance(None, None, e)
DBAPIError: (AttributeError) 'module' object has no attribute
'MssqlDatabaseException' None None
>>>
The various forum messages related to this seemed to indicate that I
needed pyodbc and/or use a URI that used a DSN etc. But may be I have
misunderstood this error. I tried different URIs and I get the same
error. I don't see any connection attempts going out of the OpenBSD
Server when I use py-sqlalchemy but tsql from FreeTDS does work however.
~ $ tsql -Spmnew -Usa
locale is "C"
locale charset is "646"
Password:
1> use pmnew
2> select * from CabType
3> go
CabTypeID CabTypeCode Description
1 BB Bluebird Bus
2 BU Bus
3 CA Cab Alongside Engine
4 CO Cab Over Engine
--
Vijay Sankar, M.Eng., P.Eng.
ForeTell Technologies Limited
59 Flamingo Avenue, Winnipeg, MB, Canada R3J 0X6
Phone: (204) 885-9535, E-Mail: [email protected]