[Zope] connet to MS-SQL database with ython script from with in zope

Jim Washington jwashin@vt.edu
Thu, 14 Feb 2002 16:29:37 -0500


mbagepll@memphis.edu wrote:
> Hi all,
> 
> I am a newbie to zope as well as to python. I want to know if i can 
> connect to a MS-SQL server database using python script from with in 
> zope. 
> I tried to import 'odbc' in the python script (from zope) and i got an 
> error message saying "import 'odbc' is unauthorised".
> 
> My code is:
> 
> import odbc
> db=odbc.odbc('mydatabase')
> cursor=db.cursor()
> cursor.execute('select * from mytable')
> for i in fetchall()
>      print i
> return printed
> 
> I am a bit confused as to how to do this from zope. Is there a odbc 
> library in zope that i have to import? i need some kind of help...

You need to install ZODBCDA, then create a Z ODBC Database Connection 
from the Add menu.  Configure it to access your MS-SQL.  Search the 
mailing list archives if you have trouble with this.  After this, you 
may make whatever ZSQL Methods you wish to interact with the SQL engine.

-- Jim Washington