Professional Documents
Culture Documents
import java.sql.*;
String data="jdbc:mysql://localhost/VEDANT";
try
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver Loaded");
Connection con=DriverManager.getConnection(data,"root","root");
System.out.println("Connection Establish...");
con.close();
Statement statement=con.createStatement();
} catch (Exception e)
System.out.println(e);
}
Experiment 19
import java.sql.*;
String data="jdbc:mysql://localhost/VEDANT";
try
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver Loaded");
Connection con=DriverManager.getConnection(data,"root","root");
System.out.println("Connection Establish...");
statement.setInt(1,38);
statement.setString(2,"vedant");
statement.setFloat(3,86f);
statement.executeUpdate();
System.out.println("Record inserted");
con.close();
} catch (Exception e)
{
System.out.println(e);
}
Expriment 20
import java.sql.*;
String data="jdbc:mysql://localhost/VEDANT";
try
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Driver Loaded");
Connection con=DriverManager.getConnection(data,"root","root");
System.out.println("Connection Establish...");
statement.executeUpdate();
System.out.println("Table updated");
Statement statement2=con.createStatement();
System.out.println("TABLE updated");
System.out.println("Deleted record");
con.close();
catch (Exception e)
{
System.out.println(e);