newbie question:connecting to a database

kavitha thankaian kavithapython at
Thu Jan 25 10:55:15 CET 2007

  I could solve the problem in connecting to a database,,,
  while configuring the daatsourcename by default it gets connected to the master table,,,so there i must specify the database which i like to connect,,,so now i can see the animals table in my database,,
  Thanks Eugene,,,

Eugene Antimirov <Eugene.Antimirov at> wrote:
  kavitha thankaian wrote:
> Hi,
> i wrote a simple script (which follows) to insert a table in the 
> database.i could execute this query and get the result in python 
> shell.but when i open "my sql enterprise manager" i couldnt find the 
> table"animals".it would be so kind of you if someone could help me,,,
> import dbi
> import odbc
> conn=odbc.odbc("DSN=mydatabase;UID=xxx;PWD=yyy")
> cursor=conn.cursor()
> cursor.execute("Create table animals(parent char(50),child char(50))")
> cursor.execute("insert into animals values('lion','cub')")
> cursor.execute("insert into animals values('goat','lamb')")
> cursor.execute("select * from animals")
> print cursor.fetchall()
> Rgds
> Kavitha
> ------------------------------------------------------------------------
You've probably missed cursor.commit() ;)

Eugene Antimirov
PortaOne, Inc., SIP Support Engineer
support at

* For further Billing and Technical information:
=> Please visit our website
=> Please visit our forum

* Meet us at Internet Telephony Conference & Expo
* Ft. Lauderdale, FL - January 24-26, 2007 - Booth 1322


 Here’s a new way to find what you're looking for - Yahoo! Answers 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list