File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Connection Caching problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Connection Caching problem" Watch "Connection Caching problem" New topic

Connection Caching problem

Rekha Pande
Ranch Hand

Joined: Jan 29, 2004
Posts: 145

i have this JSP where i'm getting rows of data displayed from the database. Some of the feilds in the row are editable and on one click of a submit button all the rows that are changed should be updated.
All this works fine but SOMETIMES, the database gets updated wiht previous value...
i don;t know whether the connection is using cached resources.... but i don't want that... how can i avoid this...!!???
Is there any feature for setting the connection string to "set cache false".
Im using jdbc:mysql connection string.

My connection string is as below
Connection conn=DriverManager.getConnection("jdbc:mysql://","net","123");

I have already used:
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);

but this doesnot work... coz the problem is not in the display of the data but my problem is that my connection uses cached resources...
How can i avoid it.. please help...
Rekha Pande
Ranch Hand

Joined: Jan 29, 2004
Posts: 145
I tried searching through google as to how the above is possible... the only way how i can see is to use oracle connection.

i have downloaded the oracle-jdbc.jar and the ojdbc14.jar file..and attached to my class path.

But when i execute the following lines of code ..

I get the following error :

Please if this is not the appropraite forum .. can one of the bartenders move this question to that forum where i can get the solution... coz it is a bit important..!

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63046

Moved to JDBC.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Carol Enderlin
Ranch Hand

Joined: Oct 10, 2000
Posts: 1364

Your connection URL uses mysql (not oracle): jdbc:mysql

Then you try to cast the connection to an oracle one and it isn't one.
Rekha Pande
Ranch Hand

Joined: Jan 29, 2004
Posts: 145
Yes Carol Enderlin you were right... when i did it with an jdbc worked fine...

Does any one have any idea how i can get the cache size of a connection when im using jdbc:mysql in the DriverManager....???

Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
You should go for MySql Documentation.
I agree. Here's the link:
subject: Connection Caching problem
It's not a secret anymore!