Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package server.barang;
- import java.sql.*;
- public class ConnectionMySQL
- {
- Connection conn=null;
- PreparedStatement pstm=null;
- ResultSet rs=null;
- public Connection getConnect()
- {
- String JDBC_DRIVER="com.mysql.jdbc.Driver";
- String JDBC_URL="jdbc:mysql://localhost:3306/gudang";
- String USER="root";
- String PASS="";
- try
- {
- Class.forName(JDBC_DRIVER);
- conn = DriverManager.getConnection(JDBC_URL,USER,PASS);
- }
- catch (Exception e)
- {
- System.out.println("Gagal Koneksi"+e.toString());
- }
- return conn;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment