Scrollable RESULTSET

import java.sql.*;
public class Arin {
public Arin(){
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://127.0.0.1/Libary","root","password");
Statement st=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
ResultSet rs=st.executeQuery("Select * from idnt");
int i=0;
while(rs.next())
i++;
System.out.println("Result Set Length:"+i);
rs.beforeFirst();
while(rs.next())
System.out.println(""+rs.getString(1));
}catch(Exception e){
System.out.println(e.toString());
}
}
public static void main(String ar[]){
new Arin();
}
}

Comments

Popular posts from this blog

Few tips for Linux User related to MAN page

SEND Mail Using JAVA Mail API