Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PreparedStatement psd = con.prepareStatement("Select job,username,password from login where job=? and username=? and password=?");
- psd.setString(1, selection);
- psd.setString(2, username);
- psd.setString(3, password);
- public static Connection getConnection() throws Exception{
- try{
- String driver="com.mysql.jdbc.Driver";
- String url="jdbc:mysql://ip_address/database_NAME";
- String username="username";
- String password="password";
- Class.forName(driver);
- Connection conn=DriverManager.getConnection(url,username,password);
- JOptionPane.showMessageDialog(null,"Connection Established");
- return conn;
- }catch(Exception e)
- {
- JOptionPane.showMessageDialog(null,"Not Connected to InternetnPlease Try Again","Error", JOptionPane.ERROR_MESSAGE);
- }
- return null;
- }//getConnection
Add Comment
Please, Sign In to add comment