Wednesday, April 05, 2006

Twisted - adbapi example

this is a simple example of adbapi use pymssql module to connect to MSSQL server.

from twisted.internet import reactor
from twisted.enterprise import adbapi
def getSites():
return dbpool.runQuery("select * from m_site")

def printResult(l):
for item in l:
print item

dbpool = adbapi.ConnectionPool("pymssql", user="sa", password="bedjo", host="192.168.31.31", database="bedjo")
getSites().addCallback(printResult)
reactor.callLater(4, reactor.stop)
reactor.run()

Thats all ... cheers

2 comments:

mandymartin8350068878 said...

While you read this, YOU start to BECOME aware of your surroundings, CERTIAN things that you were not aware of such as the temperature of the room, and sounds may make YOU realize you WANT a real college degree.

Call this number now, (413) 208-3069

Get an unexplained feeling of joy, Make it last longer by getting your COLLEGE DEGREE. Just as sure as the sun is coming up tomorrow, these College Degree's come complete with transcripts, and are VERIFIABLE.

You know THAT Corporate America takes advantage of loopholes in the system. ITS now YOUR turn to take advantage of this specific opportunity, Take a second, Get a BETTER FEELING of joy and a better future BY CALLING this number 24 hours a day.
(413) 208-3069

JCap said...

what the fuck is that other comment