Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

how to retrieve sql exceptions

Answer Posted / mukundvishy

Hashtable mapTable = new Hashtable();
Connection sqlCon = null ;
PreparedStatement pStmnt = null ;
ResultSet rSet = null;
try
{
// getConnection() method below should get connection from
pool etc.
sqlCon = getConnection();
pStmnt = sqlCon.prepareStatement( "SELECT * from tab" );
rSet = pStmnt.executeQuery();
while( rSet.next() )
{
mapTable.put( rSet.getString(1), rSet.getString(2));
}

}
catch( SQLException ex )
{
ex.printStackTrace();
}
finally
{
// The below method should close all resources peacefully
closeResources( sqlCon, pStmnt, rSet );
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the jdbc drivers in java?

981


What is meant by dao?

883


What is the return type of execute, executequery and executeupdate?

1060


What is jdbc vs odbc?

900


How can we retrieve the file in the oracle database?

912


Does the JDBC-ODBC Bridge support multiple concurrent open statements per connection?

1029


What is the purpose of the jdbc resultset interface?

866


What is correlated subquery?

2228


What is the use of dialect?

946


What is jdbc? Describe the steps needed to execute a sql query using jdbc.

847


What is an odbc driver?

853


Is jdbc faster than odbc?

843


Where jdbc drivermanager class is used?

907


What is setautocommit in jdbc?

876


List the common jdbc exceptions ?

941