Overheads involved in repeated acces to a database using JDBC  
Author Message
tangocurlysue





PostPosted: 2004-2-17 20:51:00 Top

java-programmer, Overheads involved in repeated acces to a database using JDBC I have an application that inserts words and their associated values
into a hashtable. If the word already exists in the hashtable, the
value associated with the word is increased in the hashtable. When the
hashtable is complete, I write its contents into a simple, two-column
table in a singer-user database using jdbc.I'm using MS Access at the
moment because my database doesn't need to support multiple -users or
very complex queries.

-Would I be better to take the hashtable out of the equation all
together? (i.e. read, write and update the values in the database as I
go along).

-Do you know if there is much overhead involved in contacting a
database in this way, as I would need to do it about 4,000 times?

I'm not sure how jdbc works.
-Can you alter the result set repeatedly and do a mass write to the
database at the end?

-Would another type of database suit my needs better?

Thanks in advance
~M
 
Christophe Vanfleteren





PostPosted: 2004-2-17 21:02:00 Top

java-programmer >> Overheads involved in repeated acces to a database using JDBC Marian wrote:

> I have an application that inserts words and their associated values
> into a hashtable. If the word already exists in the hashtable, the
> value associated with the word is increased in the hashtable. When the
> hashtable is complete, I write its contents into a simple, two-column
> table in a singer-user database using jdbc.I'm using MS Access at the
> moment because my database doesn't need to support multiple -users or
> very complex queries.
>
> -Would I be better to take the hashtable out of the equation all
> together? (i.e. read, write and update the values in the database as I
> go along).
>
> -Do you know if there is much overhead involved in contacting a
> database in this way, as I would need to do it about 4,000 times?
>
> I'm not sure how jdbc works.
> -Can you alter the result set repeatedly and do a mass write to the
> database at the end?
>
> -Would another type of database suit my needs better?
>
> Thanks in advance
> ~M

Keep working with the Map as you are doing now. Doing such operations in
memory will always be faster then contacting something that runs in another
process like a DB. Especially when that DB is on another computer, and
network latency and bandwith limitations could get involved.

When you're done, just use a PreparedStatement to insert the words in the
DB. If its only 4000 (which is as good as nothing for a good RDBMS) words,
it should be pretty fast, even on Acces :)

--
Kind regards,
Christophe Vanfleteren
 
tangocurlysue





PostPosted: 2004-2-18 19:18:00 Top

java-programmer >> Overheads involved in repeated acces to a database using JDBC Thanks a million for that Christophe.

~M

Christophe Vanfleteren <email***@***.com> wrote in message news:<KgoYb.4594$email***@***.com>...
>
> Keep working with the Map as you are doing now. Doing such operations in
> memory will always be faster then contacting something that runs in another
> process like a DB. Especially when that DB is on another computer, and
> network latency and bandwith limitations could get involved.
>
> When you're done, just use a PreparedStatement to insert the words in the
> DB. If its only 4000 (which is as good as nothing for a good RDBMS) words,
> it should be pretty fast, even on Acces :)