my dog learned polymorphism*
The moose likes JDBC and the fly likes Using statement object for multiple queries Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using statement object for multiple queries" Watch "Using statement object for multiple queries" New topic

Using statement object for multiple queries

Nilesh Yawale

Joined: Dec 16, 2003
Posts: 11
Hi All,
Can I use Statement object for multiple queries in different threads?..kindly explain.

Thanks in advance for your support.

Nilesh<br />SCJP<br />IBM certified for OOAD using UML
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 60785

Welcome to the Ranch "Nilesh Y"!
You'll find this forum a great place to seek help on JDBC, and there aren't many rules you'll have to worry about, but one is that proper names are required. Please take a look at the JavaRanch Naming Policy and change your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.
JDBC Forum Bartender

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dana Hanna
Ranch Hand

Joined: Feb 28, 2003
Posts: 227
You could - but the results would be crazy.
Keep a Statement local to a thread!
Have each thread use a different connection and statement!
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Using statement object for multiple queries
Similar Threads
Passing a Statement instead of a Connection?
JDBC Program Design Question
Can i use only one connection and only one statement to execute multiple queries
the real concept behind statement object
defference jdbcTemplate.queryForInt() and others