Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package BasicMysql;
- import java.sql.*;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- /**
- *
- * @author jostx
- */
- public class BasicMysql {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- String _Host = "127.0.0.1"; // HOST
- String _User = "root"; // User
- String _Pass = "251195"; // Pass
- String _DB = "system_db"; // Database
- Connection _DBConnect = null;
- try {
- Class.forName("com.mysql.jdbc.Driver");
- } catch (ClassNotFoundException e) {
- System.out.println("[MYSQL][ERROR] MySQL JDBC Driver no encontrado.");
- return;
- }
- try {
- _DBConnect = DriverManager.getConnection("jdbc:mysql://"+_Host+":3306/"+_DB+"",_User, _Pass);
- } catch (SQLException e) {
- System.out.println("[MYSQL][ERROR] "+ "["+e.getErrorCode()+"]: " + e.getMessage());
- }
- System.out.print(_DBConnect);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement