Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- // Basic DB Connection - The JDBC .jar file must be in your classpath
- // https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-installing.html
- public class DBConn {
- public static void main(String[] args) throws SQLException, ClassNotFoundException {
- // Linux jdbc driver
- Class.forName("org.mariadb.jdbc.Driver");
- // In Windows
- // Class.forName("com.mysql.jdbc.Driver");
- System.out.println("Driver loaded");
- // Attempting connection
- Connection conn = DriverManager.getConnection("jdbc:mysql://164.132.49.5", "mentcare", ""); // replace password
- System.out.println("Connected!");
- conn.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement