Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Async database API for Java

Since working with databases requires input/output, may take unbounded amount of time, etc. it seems natural to want a non-blocking, asynchronous API. Is there one for Java?

like image 599
Alexey Romanov Avatar asked May 01 '12 11:05

Alexey Romanov


Video Answer


2 Answers

I do not think that such API exists but there are 2 different things: DB access libraries and a lot of ways to perform asynchronous calls in java.

  • You can use either plain JDBC or any other higher level tool that simplifies DB access implementation to access your database.

  • You can make asynchronous calls using JMS (if you are in Java EE environment) or using queues and executors from concurrency package if your are in JSE environment. Obviously a lot of other solutions available too.

like image 196
AlexR Avatar answered Sep 28 '22 07:09

AlexR


There is no standard API like JBDC which would allow you to asynchronously call any DB. However there is this Google Project which tries to do exactly this for PostgreSQL and MySQL.

You may also take a look at this question, which addresses similar stuff:

Is asynchronous jdbc call possible?

like image 27
A.H. Avatar answered Sep 28 '22 06:09

A.H.