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
What are jdbc?
What does the connection object represents?
What happens if we don't close the connection in jdbc?
What are the new features added to JDBC 4.0?
Name the method, which is used to prepare a callablestatement.
What is a rollback in jdbc?
Is jdbc a web technology?
Which jdbc driver type s is are the jdbc odbc bridge?
What is type 4 jdbc driver?
Does jdbc require oracle client?
What are different parts of a url?
What does jdbc do?
What are types of resultset?
How many locking systems are there in jdbc?
If I use the JDBC API, do I have to use ODBC underneath?