[DB-SIG] Examples on how to use mxODBC?

Goldthwaite, Joe joe at goldthwaites.com
Thu Oct 23 19:21:49 EDT 2003


Hello again,

I was using a jgoldtest at bar-s.com email address since that is what is
configured on my python development machine.  I forgot that bar-s has a
device that appends an annoying "Property of Bar-S Foods.." message at the
end of all outgoing email.  To get around it, I had to subscribe to a
service that allows SSL connections.  What a pain.

Thanks for the responses from Marc-Andre and Andy Todd.  Between the two of
you, I got it working.  I've actually done a lot of reading.  I've gone
through the Marc's links and the mxODBC manual (which I see has your Marc's
name in the front :)).  I've also got The Python Cookbook, Programming
Python, Learning Python, Python in a Nutshell, and the Python How To Program
on-line training course.  With all that, I'm pretty sure I know exactly how
it's supposed to work.  I know I need to create a connection object with the
right parameters. I just couldn't seem to come up with a combination that
works.  I had tried this;

	from mx import ODBC
	connection = ODBC.Connect("BarsFinRpts")

And a large number of variations but I couldn't find the object that owns
the connect method.  Andy Todd provided the last piece;

	connection = ODBC.Windows.connect("BarsFinRpts")

That did it.  I was missing the Windows object between the ODBC and the
connect().  I knew it was simple.  How are you supposed to find this sort of
thing?  I've gotten used to Visual Studio where you type object. and get a
list of the properties and methods.  Does Python have anything similar?
I've tried using the dir() function to explore the namespace but when I try
dir('ODBC') I don't see the Windows object listed.  I've also tried the Wing
IDE but it just seems to show the generic namespace not the specific methods
of the current object.  It also doesn't seem to have any function help
available.

At this point, figuring out HOW to figure out this sort of problem would
probably be the best help.

Thanks again!  I really appreciate the time you guys took to reply.

Joe Goldthwaite
Phoenix, Arizona.




More information about the DB-SIG mailing list