Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JDBC and NIO

843859Nov 16 2007 — edited Nov 20 2014
Hi all,

I'm not sure whether this is the right place to post this, but I'll try.

I'm working on a multiplexed server application (using the java.nio.* classes). One issue is this--any successful client session is going to involve some DB access. What I don't want to do is, when one client's request is complete, hang up the Selector while waiting for the DB; I'd like the Selector to keep on processing other incoming client requests until the DB returns.

I can see how I'd do this by making a separate thread for the DB call...but that's not really the point of using NIO--if I'm making a separate thread for each client session anyway, I lose any advantage from multiplexing.

What I really need is something like the ability to throw JDBC Statements at the database (asynchronously) and have the results arrive in something like a Channel that I can poll periodically to see if there's anything there.

Is there an established technique for doing this sort of thing? If not, can anyone recommend a strategy?

Thanks much,
Avrom
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 17 2007
Added on Nov 16 2007
7 comments
960 views