Posts

Showing posts with the label Java Mysql Connectivity Code

Java Mysql Connectivity Code

import java.sql.DriverManager; import java.sql.ResultSet; import com.mysql.jdbc.Connection; import com.mysql.jdbc.PreparedStatement; import com.mysql.jdbc.Statement; public class jdbcConn {     private static Connection connect = null;     private static Statement statement = null;     private PreparedStatement preparedStatement = null;     private static ResultSet resultSet = null;     public static void main(String[] args) throws Exception     { try {         // This will load the MySQL driver, each DB has its own driver         Class.forName("com.mysql.jdbc.Driver");         // Setup the connection with the DB         connect = (Connection) DriverManager.getConnection("jdbc:mysql://localhost/emp?"+"user=root");     ...