473,397 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

ODBC Select

I am trying to connect to my MySQL database using python and ODBC.

Here is what I am doing.
import dbi,odbc
conn=odbc.odbc("dsn=facs")
cursor=conn.cursor()
cursor.execute("select * from data") 0
Notice I get the "0" after the select statement.
Problem is, there are 20 records in the database. In fact I can do this
cursor.execute("insert into data (facility) values ('AAA')") 1
and then I can do this
cursor.execute("delete from data where id > 20") 1
but when I do
cursor.execute("select * from data") 0


Anyone seen this and can maybe tell me why this is occuring. I have
full privileges as I can log on and query with the DSN from other programs.

Thanks,
Larry

Jul 18 '05 #1
2 1970
Larry wrote:
I am trying to connect to my MySQL database using python and ODBC.

Here is what I am doing.
>>> import dbi,odbc
>>> conn=odbc.odbc("dsn=facs")
>>> cursor=conn.cursor()
>>> cursor.execute("select * from data") 0 >>>
Notice I get the "0" after the select statement.
Problem is, there are 20 records in the database. In fact I can do this
>>> cursor.execute("insert into data (facility) values ('AAA')") 1 >>>
and then I can do this
>>> cursor.execute("delete from data where id > 20") 1 >>>
but when I do
>>> cursor.execute("select * from data") 0 >>>


Anyone seen this and can maybe tell me why this is occuring. I have
full privileges as I can log on and query with the DSN from other programs.

Thanks,
Larry

According to PEP 249, the return value for cursor.execute() is undefined
and there seems to be little documentation for the ODBC module, so my
guess (and I can't confirm it from home where I have no Windows) is that
0 indicates "success" and has nothing to do with the number of
records. Have you tried a "print cursor.fetchone()" to see if anything
is there?
Jul 18 '05 #2
> According to PEP 249, the return value for cursor.execute() is undefined
and there seems to be little documentation for the ODBC module, so my
guess (and I can't confirm it from home where I have no Windows) is that
0 indicates "success" and has nothing to do with the number of
records. Have you tried a "print cursor.fetchone()" to see if anything
is there?


Wow!
I feel silly!
Just as you said.
The records are there.
Thanks!

Larry
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Sean Anderson | last post by:
ODBC under System DSN Setup Access Driver give it the DSN (Data Source Name) MSA Click on Select and point to the myfile.mdb (your database file)
6
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used...
2
by: uli2003wien | last post by:
Dear group, we are dealing with some very specific problems with ODBC, where a connection from SQL-Server to Mysql works with ODBC-driver 3.51.10.00 and does NOT work with ODBC-driver...
4
by: Roger Redford | last post by:
Dear Experts, I'm attempting to marry a system to an Oracle 817 datbase. Oracle is my specialty, the back end mainly, so I don't know much about java or javascript. The system uses javascript...
14
by: Abhi | last post by:
FYI: This message is for the benefit of MS Access Community. I found that this prblem has been encounterd by many but there is hardly any place where a complete solution is posted. So I thought...
4
by: Dave | last post by:
Hey guys, I have an ODBC problem that has me stumped. I wrote a VBA script to run in Microsoft Excel that pulls data out of an application using that application's ODBC driver and puts it into...
2
by: polpe | last post by:
Hello, i have a filemaker server 5.5 with some shared files. I don't understand how use ODBC with these files to import a database in Access. Can anyone help me? Polpe from Italy
16
by: network-admin | last post by:
We have Problems with Access query on Oracle 10g Database with ODBC Connection. The Query_1 is such as select * from xtable where ycolumn <"S" Result = ODBC Faild...
7
by: Salad | last post by:
I am converting an application from A97 to A2003. I have 2 tables created by another application as a Foxpro.dbf. The table has no index. The connect string in A97 is FoxPro...
3
by: Salad | last post by:
With the database window open I click on Help, then click on "About Microsoft Office Access". A dialog window is presented and there are 4 buttons at the bottom right of the form. One is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.