First Download Jar file For database Connection
click here to Download
Add this Jar File in lib in your Project..
import java.sql.*;
public class Advanced {
public static void main(String[] args) throws SQLException {
Connection con=null;
String name="books";
String pas="book";
String sqlcon="jdbc:mysql://localhost/umtskt";
String sql="insert into person (firstname,lastname,email) value (?,?,?)";
try{
con=DriverManager.getConnection(sqlcon,name,pas);
stm=con.prepareStatement(sql);
}
catch(SQLException e)
{
e.printStackTrace();
}
}
}
click here to Download
Add this Jar File in lib in your Project..
import java.sql.*;
public class Advanced {
public static void main(String[] args) throws SQLException {
Connection con=null;
String name="books";
String pas="book";
String sqlcon="jdbc:mysql://localhost/umtskt";
String sql="insert into person (firstname,lastname,email) value (?,?,?)";
try{
con=DriverManager.getConnection(sqlcon,name,pas);
stm=con.prepareStatement(sql);
}
catch(SQLException e)
{
e.printStackTrace();
}
}
}