This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

JDBC multiple statements in prepatedStatement?

 
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?
 
author & internet detective
Posts: 39789
797
Eclipse IDE VI Editor Java
  • 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
 
Paddy spent all of his days in the O'Furniture back yard with this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!