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 is setautocommit in jdbc?

888


Explain the JDBC Architecture?

975


Which type of driver provides jdbc access via one or more odbc drivers?

857


Why would you use setautocommit(false) in jdbc?

1141


How do I know which jdbc driver to use?

968


What is jdbc and explain jdbc architecture?

968


What are the advantages of collection pools?

985


What is jndi lookup?

895


What does setautocommit do?

932


What is jdbc odbc in java?

1004


Where is mysql jdbc driver located?

977


How to use JDBC API to call Stored Procedures?

986


What is the return type of class.forname() method?

912


What is the difference between executing, executequery, executeupdate in jdbc?

963


What is jdbc drivers in java?

878