my dog learned polymorphism*
The moose likes JDBC 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 Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection Caching problem" Watch "Connection Caching problem" New topic
Author

Connection Caching problem

Rekha Pande
Ranch Hand

Joined: Jan 29, 2004
Posts: 145
Hi,

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://222.1.2.3:3306/itsupport","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 :
ERROR
------
java.lang.ClassCastException
java.lang.ClassCastException


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..!

Thanxs...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60752
    
  65

Moved to JDBC.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Carol Enderlin
drifter
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 racle..it 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....???

Thanxs
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
You should go for MySql Documentation.
 
 
subject: Connection Caching problem
 
Similar Threads
Distributed Caching
download problem
[Hibernate]: Second Lv Cache (with Async Updates)
Delete cached data and load from database
Page Caching...