Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- https://dev.mysql.com/downloads/connector/j/5.1.html (download it)
- platform independant
- open eclipse
- make project
- right click project
- go to properties
- java build path
- libraries
- add external jars
- import java.sql.*;
- class myexample{
- private connection con;
- private statements st; (for queries)
- private resultset rs; (to store result of queries)
- private preparedstatements prep;
- myexample (){
- con=nulll;
- st=null;
- rs=null;
- prep=null;
- }
- public void run(){
- class.ForName(com.Mysql.jdbc.Driver");
- con = driverMnaager.getConnection("jdbc:mysql://localhost/Faadi?user="Root"") (Root ki jagan user name aaey ga, Faadi ki jagan db name m)
- st = con.createStatement();
- query = "create table sc(id int not null, name varchar(40), primary key(id))";
- st.executeUpdate(query);
- query = ""
- }
- }
Add Comment
Please, Sign In to add comment