Posts

Showing posts from August, 2020

JDBC Connectivity using Eclipse

 import java.io.BufferedReader; import java.io.InputStreamReader; import java.sql.*;   public class mysqlconn { public static void main(String args[]){   try{   Class.forName("com.mysql.cj.jdbc.Driver");   Connection con=DriverManager.getConnection(   "jdbc:mysql://localhost:3306/demo","root","root");   Statement stmt=con.createStatement();   ResultSet rs=stmt.executeQuery("select * from emp");   while(rs.next())   System.out.println(rs.getInt(1)+"  "+rs.getString(2));  int i=17; String name1="smita"; int did=4; int credit =2000; InputStreamReader r1=new InputStreamReader(System.in);     BufferedReader br1=new BufferedReader(r1);             System.out.println("Enter your id");     try { name1=br1.readLine();  }catch(Exception E) {} i=Integer.parseInt(name1); InputStreamReader r=new InputStreamReader(System.in);     BufferedReader