This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes JDBC and the fly likes DB Connection null error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "DB Connection null error" Watch "DB Connection null error" New topic
Author

DB Connection null error

Swetha Raju
Greenhorn

Joined: Jun 30, 2008
Posts: 2
I have this batch process running with Java and DB used it MS SQL.THe process takes about an hour to complete.The process suddenly fails in between because of DB Connection failing.I get a DB connection null after lets say after processing some 5000 records and that is consistant.Not sure why this is happening.Any clue why this could happen?
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3710
    
    5

Check the database configuration (and network configuration of the server) it's quiet possible there's a maximum time out set. Oh and for performance, are you using JDBC batch tools? Keep in mind if you have, say 100,000 records to insert, the optimal solution is often of the form to send them to the database in 200 sets of 500 records, thereby using 200 small/medium sized network transports. Other solutions such as sending one at a time (100,000 connections) or all at once (1 huge package) fail for network-related reasons. The first fails for time, the overhead of creating/sending each message is too big. The second fails often because of a package limit on the server or network.


My Blog: Down Home Country Coding with Scott Selikoff
Brian Hart II
Greenhorn

Joined: Jul 04, 2008
Posts: 3
There is likely something fundamentally wrong with your code if it takes an hour to process 5,000 records then fail. Can you post the relevant code?
Scott Selikoff
author
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3710
    
    5

Originally posted by Brian Hart II:
There is likely something fundamentally wrong with your code if it takes an hour to process 5,000 records then fail. Can you post the relevant code?


Not necessarily, if its sending one record at a time instead of a batched set of records this performance is far more common that you'd thing for computers not directly connected to one another.
 
GeeCON Prague 2014
 
subject: DB Connection null error