[DB-SIG] python connection to Velocis Database

Carl Karsten carl at personnelware.com
Tue Dec 8 06:58:50 CET 2009


On Mon, Dec 7, 2009 at 11:40 PM, Susan <shuying at gmail.com> wrote:
> Thanks Vernon & Marc-Andre for your replies. Your suggestion has been
> helpful and I am running Microsoft Windows. The following:
>
> from win32com.client import Dispatch
> conn = Dispatch(r'ADODB.Connection')
> conn.Open("Dsn=xxx;uid=xxx;pwd=xxx")
> conn.Execute('create table foo (blah char(30) )')
> conn.Execute("insert into foo values('jenny')")
> conn.Close()
>
> works and creates a table 'foo'.
>
> However, a simple select results in an error:
>
> from win32com.client import Dispatch
> conn = Dispatch(r'ADODB.Connection')
> conn.Open("Dsn=xxx;uid=xxx;pwd=xxx")
>  recset, affected = conn.Execute('select name from tablename')
> conn.Close()
>
>>>> recset, affected = conn.Execute('select name from tablename')
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "<COMObject ADODB.Connection>", line 3, in Execute
>  File "C:\Python26\lib\site-packages\win32com\client\dynamic.py",
> line 272, in _ApplyTypes_
>    result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags,
> retType, argTypes) + args)
> pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None,
> None, None, 0, -2147467259), None)
>
> Has anyone who has worked on old, esoteric databases before
> encountered a similar problem and solved it?

I had to connect to something (i forget exactly what) but it had
quircks.  I tried this and that, and had the best luck with

http://ceodbc.sourceforge.net

One of the best parts was getting it patched to work around some
hardcoded hack in the odbc driver I was using.   get it, try it, join
the mail list.

-- 
Carl K


More information about the DB-SIG mailing list