FAQ
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


---------------------------------
Here?s a new way to find what you're looking for - Yahoo! Answers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-list/attachments/20070122/b7196d39/attachment.html

Search Discussions

  • Eugene Antimirov at Jan 22, 2007 at 10:24 am

    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() ;)

    --
    Sincerely,
    Eugene Antimirov
    PortaOne, Inc., SIP Support Engineer
    support at portaone.com

    * For further Billing and Technical information:
    => Please visit our website http://www.portaone.com
    => Please visit our forum http://forum.portaone.com

    * Meet us at Internet Telephony Conference & Expo
    * Ft. Lauderdale, FL - January 24-26, 2007 - Booth 1322
    * http://www.tmcnet.com/voip/conference/
  • Eugene Antimirov at Jan 22, 2007 at 11:09 am

    Eugene Antimirov wrote:
    You've probably missed cursor.commit() ;)
    Sorry, my bad:

    conn.commit() is correct one AFAIR.


    --
    Sincerely,
    Eugene Antimirov
    PortaOne, Inc., SIP Support Engineer
    support at portaone.com

    * For further Billing and Technical information:
    => Please visit our website http://www.portaone.com
    => Please visit our forum http://forum.portaone.com

    * Meet us at Internet Telephony Conference & Expo
    * Ft. Lauderdale, FL - January 24-26, 2007 - Booth 1322
    * http://www.tmcnet.com/voip/conference/
  • Kavitha thankaian at Jan 23, 2007 at 8:25 am
    Hi Eugene,

    I tried with conn.commit() as well,,but doesnt seem to work.
    Also i cannot even view the existing tables via python script.For example,,,i have manually added a customer table in my database.but if i execute the query, select * from customer,,,i get the following error:

    mxODBC.ProgrammingError: ('S0002', 208, "[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name customer.", 4612)

    If someone knows the solution please help me,,,

    Kavitha
    Eugene Antimirov wrote:
    Eugene Antimirov wrote:
    You've probably missed cursor.commit() ;)
    Sorry, my bad:

    conn.commit() is correct one AFAIR.


    --
    Sincerely,
    Eugene Antimirov
    PortaOne, Inc., SIP Support Engineer
    support at portaone.com

    * For further Billing and Technical information:
    => Please visit our website http://www.portaone.com
    => Please visit our forum http://forum.portaone.com

    * Meet us at Internet Telephony Conference & Expo
    * Ft. Lauderdale, FL - January 24-26, 2007 - Booth 1322
    * http://www.tmcnet.com/voip/conference/

    --
    http://mail.python.org/mailman/listinfo/python-list



    ---------------------------------
    Here?s a new way to find what you're looking for - Yahoo! Answers
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://mail.python.org/pipermail/python-list/attachments/20070123/91db0f2f/attachment-0001.html

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
categoriespython
postedJan 22, '07 at 8:31a
activeJan 23, '07 at 8:25a
posts4
users2
websitepython.org

People

Translate

site design / logo © 2022 Grokbase