Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC multiple statements in prepatedStatement?

 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am currently using preparedStatements to do selects in my web app.

I need to do this:

SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED ;
SELECT * FROM TABLE_NAME ;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ ;

So i can have no lock on the table when I select from it.

How would I do that in a prepared statement or regular statement in java?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
You wouldn't. You would use a transaction manager to control the transaction. I don't follow the example yet. Those isolation levels don't have meaning for just one statement.
 
John Schretz
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a website that has a PRODUCT table. when the pages display it selects from this table.

I also have a sync program that sends data to the webserver and either inserts or updates that same product table.

When i monitor the connections in mysql workbench i keep seeing under status for those selects "Locked"

and copying to tmp table. The sync takes forever to finish because of this and then the pages on the website load very slow.

i had this running for 2 years no problem, i dont know if the hosting company messed with the server but i just want to be able to do my inserts and updates on that table without locking when the selects are happening too

the server is set up as MyISAM
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic