473,785 Members | 2,317 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connection seems to cache data

I open MySQL Manager and connect to my database.

I then insert one record in to an InnoDB table in MySQL (4.0 and 4.1
alpha hosted on XP running mysqld --console).

I then retrieve the record successfully in MySQL Manager using the
existing connection. This indicates that commit is running
successfully, (I have seen this on the database trace too).

I then try to retrieve the record (through a small MySQL/TomCat
application). Sometimes it is retrieved successfully, and sometimes an
empty record set is returned.

If I reduce connection pooling (on the connection script (in
components.xcon f))to min 1 max 1 connections, the record is retrieved
successfully every time.

This seems to me to indicate that existing connections created for my
TomCat app are searching on an old (maybe cached?) version of the
database. However, when by chance I get the same connection I used to
insert the record, the record is retrieved successfully.

However, the record is retrieved more often than not even when there
are 10 connections pooled, although I understand that connections are
not round-robbined and some are used more commonly than others,
supporting my suspision.

This is the only insert that uses transactions in my app, and it works
fine with Oracle. All other inserts (not using transactions) work fine
on both database servers (and both MySQL 4.1.1-alpha and 4.0.16).

Thanks very much for any time spent on this and any recommendations
for further tests or fixes.
Jul 19 '05 #1
4 2273
up*********@hot mail.com (chris) wrote in message news:<c6******* *************** ***@posting.goo gle.com>...
I open MySQL Manager and connect to my database.

I then insert one record in to an InnoDB table in MySQL (4.0 and 4.1
alpha hosted on XP running mysqld --console).

I then retrieve the record successfully in MySQL Manager using the
existing connection. This indicates that commit is running
successfully, (I have seen this on the database trace too).

I then try to retrieve the record (through a small MySQL/TomCat
application). Sometimes it is retrieved successfully, and sometimes an
empty record set is returned.

If I reduce connection pooling (on the connection script (in
components.xcon f))to min 1 max 1 connections, the record is retrieved
successfully every time.

This seems to me to indicate that existing connections created for my
TomCat app are searching on an old (maybe cached?) version of the
database. However, when by chance I get the same connection I used to
insert the record, the record is retrieved successfully.

However, the record is retrieved more often than not even when there
are 10 connections pooled, although I understand that connections are
not round-robbined and some are used more commonly than others,
supporting my suspision.

This is the only insert that uses transactions in my app, and it works
fine with Oracle. All other inserts (not using transactions) work fine
on both database servers (and both MySQL 4.1.1-alpha and 4.0.16).

Thanks very much for any time spent on this and any recommendations
for further tests or fixes.


The Workaround, further indicating that this is indeed a bug in MySQL.

I installed MySQL server 3.23.53, enabled InnoDB tables in my.cnf
(with the line innodb_data_fil e_path=ibdata:3 0M under the [mysqld]
section) and ran mysqld-max.exe and the problem seems to have
disappeared and transactions are working as they should. (But MySQL <
4.1.1 doesn't do subqueries etc...)

I have sent a bug report to MySQL.

Thanks again for any time anyone has spent on this. I am still
confused that I cannot find any sign of this defect anywhere on the
net.
Jul 19 '05 #2
up*********@hot mail.com (chris) wrote in message news:<c6******* *************** ***@posting.goo gle.com>...
I open MySQL Manager and connect to my database.

I then insert one record in to an InnoDB table in MySQL (4.0 and 4.1
alpha hosted on XP running mysqld --console).

I then retrieve the record successfully in MySQL Manager using the
existing connection. This indicates that commit is running
successfully, (I have seen this on the database trace too).

I then try to retrieve the record (through a small MySQL/TomCat
application). Sometimes it is retrieved successfully, and sometimes an
empty record set is returned.

If I reduce connection pooling (on the connection script (in
components.xcon f))to min 1 max 1 connections, the record is retrieved
successfully every time.

This seems to me to indicate that existing connections created for my
TomCat app are searching on an old (maybe cached?) version of the
database. However, when by chance I get the same connection I used to
insert the record, the record is retrieved successfully.

However, the record is retrieved more often than not even when there
are 10 connections pooled, although I understand that connections are
not round-robbined and some are used more commonly than others,
supporting my suspision.

This is the only insert that uses transactions in my app, and it works
fine with Oracle. All other inserts (not using transactions) work fine
on both database servers (and both MySQL 4.1.1-alpha and 4.0.16).

Thanks very much for any time spent on this and any recommendations
for further tests or fixes.


The Workaround, further indicating that this is indeed a bug in MySQL.

I installed MySQL server 3.23.53, enabled InnoDB tables in my.cnf
(with the line innodb_data_fil e_path=ibdata:3 0M under the [mysqld]
section) and ran mysqld-max.exe and the problem seems to have
disappeared and transactions are working as they should. (But MySQL <
4.1.1 doesn't do subqueries etc...)

I have sent a bug report to MySQL.

Thanks again for any time anyone has spent on this. I am still
confused that I cannot find any sign of this defect anywhere on the
net.
Jul 19 '05 #3
up*********@hot mail.com (chris) wrote in message news:<c6******* *************** ****@posting.go ogle.com>...
up*********@hot mail.com (chris) wrote in message news:<c6******* *************** ***@posting.goo gle.com>...
I open MySQL Manager and connect to my database.

I then insert one record in to an InnoDB table in MySQL (4.0 and 4.1
alpha hosted on XP running mysqld --console).

I then retrieve the record successfully in MySQL Manager using the
existing connection. This indicates that commit is running
successfully, (I have seen this on the database trace too).

I then try to retrieve the record (through a small MySQL/TomCat
application). Sometimes it is retrieved successfully, and sometimes an
empty record set is returned.

If I reduce connection pooling (on the connection script (in
components.xcon f))to min 1 max 1 connections, the record is retrieved
successfully every time.

This seems to me to indicate that existing connections created for my
TomCat app are searching on an old (maybe cached?) version of the
database. However, when by chance I get the same connection I used to
insert the record, the record is retrieved successfully.

However, the record is retrieved more often than not even when there
are 10 connections pooled, although I understand that connections are
not round-robbined and some are used more commonly than others,
supporting my suspision.

This is the only insert that uses transactions in my app, and it works
fine with Oracle. All other inserts (not using transactions) work fine
on both database servers (and both MySQL 4.1.1-alpha and 4.0.16).

Thanks very much for any time spent on this and any recommendations
for further tests or fixes.


The Workaround, further indicating that this is indeed a bug in MySQL.

I installed MySQL server 3.23.53, enabled InnoDB tables in my.cnf
(with the line innodb_data_fil e_path=ibdata:3 0M under the [mysqld]
section) and ran mysqld-max.exe and the problem seems to have
disappeared and transactions are working as they should. (But MySQL <
4.1.1 doesn't do subqueries etc...)

I have sent a bug report to MySQL.

Thanks again for any time anyone has spent on this. I am still
confused that I cannot find any sign of this defect anywhere on the
net.


Thanks to some great support from MySQL, I can confirm that this is
not a bug. Their explanation is concise:

It is due to InnoDB being multiversioning and the default isolation
level is REPEATABLE_READ , so therefore each connection is working off
a snapshot of any particular table at a point-in-time when that
connection's transaction started. If you already have a transaction in
progress on another connection, and you want to 'see' the results of a
subsequent transaction on a different connection, you have to make
sure you have a new 'snapshot' of the data, by calling 'commit' before
trying to reference the data. See:

http://www.innodb.com/ibman.php#Exam...onsistent_read

My guess is your application on Oracle is running in an isolation
level
of 'READ_COMMITTED ' (which is their default, I believe)[this is all
correct]. If your application ran in an isolation level of
'REPEATABLE_REA D', I would
venture to say you would see similar behavior.

I inserted a commit before the SELECT statement in question, and that
solved the problem. I removed it and added the line:

transaction-isolation = READ-UNCOMMITTED

...to the [mysqld] section of my C:\my.cnf file and that also fixed the
problem.
Jul 19 '05 #4
up*********@hot mail.com (chris) wrote in message news:<c6******* *************** ****@posting.go ogle.com>...
up*********@hot mail.com (chris) wrote in message news:<c6******* *************** ***@posting.goo gle.com>...
I open MySQL Manager and connect to my database.

I then insert one record in to an InnoDB table in MySQL (4.0 and 4.1
alpha hosted on XP running mysqld --console).

I then retrieve the record successfully in MySQL Manager using the
existing connection. This indicates that commit is running
successfully, (I have seen this on the database trace too).

I then try to retrieve the record (through a small MySQL/TomCat
application). Sometimes it is retrieved successfully, and sometimes an
empty record set is returned.

If I reduce connection pooling (on the connection script (in
components.xcon f))to min 1 max 1 connections, the record is retrieved
successfully every time.

This seems to me to indicate that existing connections created for my
TomCat app are searching on an old (maybe cached?) version of the
database. However, when by chance I get the same connection I used to
insert the record, the record is retrieved successfully.

However, the record is retrieved more often than not even when there
are 10 connections pooled, although I understand that connections are
not round-robbined and some are used more commonly than others,
supporting my suspision.

This is the only insert that uses transactions in my app, and it works
fine with Oracle. All other inserts (not using transactions) work fine
on both database servers (and both MySQL 4.1.1-alpha and 4.0.16).

Thanks very much for any time spent on this and any recommendations
for further tests or fixes.


The Workaround, further indicating that this is indeed a bug in MySQL.

I installed MySQL server 3.23.53, enabled InnoDB tables in my.cnf
(with the line innodb_data_fil e_path=ibdata:3 0M under the [mysqld]
section) and ran mysqld-max.exe and the problem seems to have
disappeared and transactions are working as they should. (But MySQL <
4.1.1 doesn't do subqueries etc...)

I have sent a bug report to MySQL.

Thanks again for any time anyone has spent on this. I am still
confused that I cannot find any sign of this defect anywhere on the
net.


Thanks to some great support from MySQL, I can confirm that this is
not a bug. Their explanation is concise:

It is due to InnoDB being multiversioning and the default isolation
level is REPEATABLE_READ , so therefore each connection is working off
a snapshot of any particular table at a point-in-time when that
connection's transaction started. If you already have a transaction in
progress on another connection, and you want to 'see' the results of a
subsequent transaction on a different connection, you have to make
sure you have a new 'snapshot' of the data, by calling 'commit' before
trying to reference the data. See:

http://www.innodb.com/ibman.php#Exam...onsistent_read

My guess is your application on Oracle is running in an isolation
level
of 'READ_COMMITTED ' (which is their default, I believe)[this is all
correct]. If your application ran in an isolation level of
'REPEATABLE_REA D', I would
venture to say you would see similar behavior.

I inserted a commit before the SELECT statement in question, and that
solved the problem. I removed it and added the line:

transaction-isolation = READ-UNCOMMITTED

...to the [mysqld] section of my C:\my.cnf file and that also fixed the
problem.
Jul 19 '05 #5

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

Similar topics

12
3666
by: Cliff Wells | last post by:
Hi, I'm writing an application that needs to know if an Internet connection is available. Basically, I want to have something similar to what a lot of email clients have, where the app can work either in "online" or "offline" mode (it keeps a cache of downloaded info, so it can work without a connection if needed). The basic problem is this: it downloads info (RSS feeds) from a variety of sources. Any one (or more) of these could...
15
6520
by: The Fumigator | last post by:
Hi. I want to be able to create a persistent connection between an XML-RPC client and server... i.e. I want to be able to login once, carry out a number of calls and then logout rather than send login info for every call. Is there a way to do this with the xml-rpc code in the standard library? Thanks in advance
0
1387
by: chris | last post by:
I open MySQL Manager and connect to my database. I then insert one record in to an InnoDB table in MySQL (4.0 and 4.1 alpha hosted on XP running mysqld --console). I then retrieve the record successfully in MySQL Manager using the existing connection. This indicates that commit is running successfully, (I have seen this on the database trace too). I then try to retrieve the record (through a small MySQL/TomCat
4
17659
by: refer_to_website | last post by:
How can I use the Server.MapPath(".") value inside of the web.config? For example, when I add the following just before the </configuration>, and run via CTRL-F5, I receive error The '&' character, hexadecimal value 0x26, cannot begin with a name. <appSettings> <add key="ConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(".") & "DATABASE\test.mdb;" />
3
8332
by: John | last post by:
Hi I have a dataset from a web service. I want to use a dataadapter with the dataset. What connection string should I use so the da knows that it is acting on the remote db associated with the web service dataset? Thanks Regards
3
2119
by: Martin B | last post by:
Hallo! I'm working with C# .NET 2.0, implementing Client/Server Applications which are connecting via Network to SQL-Server or Oracle Databases. To stay independent from the underlaying Database I use System.Data.Common.DBConnection and .DBCommand. How can I keep aware from connection losses (network not availeable, db-server not available...)? Are there any strategies to detect this broken connections, and how can I
0
1968
by: jdn4929 | last post by:
The state server has closed an expired TCP/IP connection. The IP address of the client is 127.0.0.1. The expired Read operation began at 11/16/2007 14:31:49. This one has been bothering me for quite some time... there didn't seem to be any real solutions for this or they didn't seem to apply. Microsoft discusses this issue in the Knowledge base, but it seems to only happen under very heavy load, and their resolution didn't fix my...
0
9643
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10315
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8968
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6737
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.