Re: simple questions, but hard to find an exact answer
Posted by: Mark Matthews
Date: March 10, 2005 09:43AM

joewaster wrote:
> Can you have more than one statment at the
> sametime on the same connection??
> for example
> conn = ds.getConnection();
> Statement stmt = conn.createStatement();
> rs = stmt.executeQuery("SELECT SOMETHING");
> Statement stmt2 = conn.createStatement();
> rs2 = stmt2.executeQuery("SELECT SOMETHINGELSE");
> this works fine right?


Sure. That's fine. The JDBC apidocs and spec even say so.

> does this mean I can have two resultsets open at
> the same time?

On a given statement? That's true. On a given connection? You can have as many result sets open on a given connection as you want.

> I always hear that you can only have one resultset
> open at a time,
> so thats why I am kind confused, can someone
> clarify this??

Hopefully I clarified it...I'd be curious where you 'always hear that ...', because it's not true, or at least it's not completely correct ;).


Mark Matthews
Consulting Member Technical Staff - MySQL Enterprise Tools

Options: ReplyQuote

Written By
Re: simple questions, but hard to find an exact answer
March 10, 2005 09:43AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.