Step 1: Intall JDK-JRE on Root
Step 2: Instell Eclipseimport java.sql.*;
public class Demo{
public static void main(String[] args) {
try{
Class.forName("com.mysql.jdbc.
}catch(ClassNotFoundException e){
System.out.println(e.
}
try{
Connection con = DriverManager.getConnection("
Statement st = con.createStatement();
ResultSet rs=st.executeQuery("select * from emp");
while(rs.next())
{
int emp_id = rs.getInt("EMPID");
String emp_name=rs.getString("
String emp_dept=rs.getString("
System.out.println("\nEMP ID= "+emp_id+"\nEMP Name= "+emp_name+"\nEMP Department= "+emp_dept);
}
st.close();
con.close();
}
catch(SQLException e)
{
System.out.println(e.
}
}
}
execute this code, you will gate error.
Step 4: https://www.youtube.com/watch?
No comments:
Post a Comment