473,587 Members | 2,466 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.cur sor()
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 1975
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.cur sor()
>>> 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
5203
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
6760
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 the SQL Profile to watch the T-SQL-Command which Access ( who creates the commands?) creates and noticed:
2
2238
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 3.51.11.00. Maybe someone experiences similar problems or even has a solution ? Some feedback (to the group) would be highly appreciated. We use a...
4
7228
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 to make ODBC calls to the db. The particular system I'm working with, will not work with an Oracle stored procedure I'm told. However, it
14
10121
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 I should give back to the community by posting our findings. Thanks you all for all your help till now by posting problems and their solutions. ...
4
3565
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 Excel. I am trying to translate the same program over to Microsoft Access and I ran into a problem. Access locks up if the data I am querying for is...
2
5710
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
9171
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
3043
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 2.0;HDR=NO;IMEX=2;DATABASE=C:\Test It's really easy to connect to those tables in A97. I'm having difficulties in A2003. I'm trying to follow the instructions in...
3
2093
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 SystemInfo and when I press that I get a Summary dialog box of particulars. One of the options is Office 2003 Applications. If I press on the plus sign...
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7849
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8347
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6626
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5718
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5394
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.