views:

450

answers:

3

I need to update data to a mssql 2005 database so I have decided to use adodbapi, which is supposed to come built into the standard installation of python 2.1.1 and greater.

It needs pywin32 to work correctly and the open office python 2.3 installation does not have pywin32 built into it. It also seems like this built int python installation does not have adodbapi, as I get an error when I go import adodbapi.

Any suggestions on how to get both pywin32 and adodbapi installed into this open office 2.4 python installation?

thanks


oh yeah I tried those ways. annoyingly nothing. So i have reverted to jython, that way I can access Open Office for its conversion capabilities along with decent database access.

Thanks for the help.

A: 

I don't know about open office python. I suggest trying the standard windows python installation followed by Pywin32. Alternatively, there is a single installer containing both at activestate. In the pythonwin IDE, select menu item tools / COM Makepy utility. The libraries you need to build with makepy are (or similar versions):

Microsoft ActiveX Data Objects 2.8 Library (2.8)
Microsoft ActiveX Data Objects Recordset 2.8 Library (2.8)

After makepy is done, you can use the COM object to access ADODB:

from win32com import client
conn=client.Dispatch('adodb.connection')
conn.Open(connection_string)
resultset,x=e.Execute('select * from mytable')
resultset.MoveFirst()
record_fields=resultset.Fields
(etc.)
gimel
+1  A: 

maybe the best way to install pywin32 is to place it in

(openofficedir)\program\python-core-2.3.4\lib\site-packages

it is easy if you have a python 2.3 installation (with pywin installed) under

C:\python2.3

move the C:\python2.3\Lib\site-packages\ to your

(openofficedir)\program\python-core-2.3.4\lib\site-packages

Blauohr
The same thing is true for any Python module/package.If you install the same Python version as OpenOffice is using, then install modules in that Python version, and then move the module/package from one site-packages to the other, then you can use it in OpenOffice.
Michael Dillon