Zope and NT databases

marc_risney at my-deja.com marc_risney at my-deja.com
Mon Jan 10 16:25:01 EST 2000


Hmmm, yes Zope is one way to do it, ODBC Socket Server,
is actually rather elegant, here is sample code that you could use
provided that you download the ODBC Socket Server
from http://odbc.linuxbox.com/products.html

Python 1.5.2 (#1, Jan  6 2000, 15:54:56)  [GCC egcs-2.91.66 19990314
(egcs-1.1.2
  on linux2
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>>from socket import *
>>>import select

>>>FORWARD = 'ntbox.domain.com'
>>>PORT = 9628
>>>s = socket(AF_INET, SOCK_STREAM)
>>>s.connect(FORWARD, PORT)

>>>conn_str = "DSN=ODBCSS;UID=;PWD=;"
>>>sql_str = "insert into Table1 values ('test1','test2')"

>>>xml_str = """<?xml version=\"1.0\"?
>\r\n<request>\r\n<connectionstring>""" + conn_str
+ "</connectionstring>\r\n<sql>" + >>>sql_str
+ "</sql>\r\n</request>\r\n"
>>>s.send(xml_str)
>>>msg = s.recv(1024)
>>>s.close()
>>>print str(msg)


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list