import java.sql.*;
class MysqlCon
{
public static void main(String[] args)
{
try{
Connection con = DriverManager.getConnection("jdbc:mysql:///new","root","root");
Statement st = con.createStatement();
String query = "select * from login";
ResultSet rs = st.executeQuery(query);
while(rs.next()){
System.out.println(rs.getString(1)+" "+rs.getString(2));
}
con.close();
}catch(SQLException e){
System.out.println("Error");
}catch(Exception e){
}
}
}
Comments
Post a Comment