Professional Documents
Culture Documents
getConnection(String url)
getConnection(String url, String
userID, String password)
getConnection(String url, Properties
arguments)
GetLoginTimeout() Gets the maximum time in seconds that a driver can wait
when attempting to log in to a database.
SetLoginTimeout() Sets the maximum time in seconds that a driver will wait
while attempting to connect to a database.
Methods Description
import java.sql.*;
import java.util.*;
class DriverDetail {
public static void main(String args[]) {
try{
//Registring the driver
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch(Exception ex){
System.out.println(ex);
System.exit(0);
}
}//PSVM
}//Class
class ConnectMeta {
public static void main(String args[]) {
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
connection=DriverManager.getConnection("jdbc:
odbc:anuj","","");
DatabaseMetaData
meta=connection.getMetaData();
deleteRow() JDBC 2.0 Deletes the current row from the result
set and the underlying database.
findColumn(Strin Maps the given Resultset column name to its
g columnName) ResultSet column index.
next ( ) Moves the cursor down one row from its current
position.
previous() Moves the cursor in the backward direction
class ResultSet1 {
public static void main(String args[]) {
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:anuj","","");
Statement stmt = con.createStatement();
ps.setString(1, "Tom");
ps.setInt(2,3);
ps.executeUpdate();
while(rs.next()){
String s=rs.getString("empName");
int n=rs.getInt("empID");
} con.close();
System.exit(0);
Old D/B
On Rollback