Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Conexao {
- // JDBC driver name and database URL
- static final String DB_DRIVER = "com.mysql.jdbc.Driver";
- static final String DB_CONNECTION = "jdbc:mysql://localhost:3306/UBSTech";
- static final String DB_USER = "root";
- static final String DB_PASSWORD = "";
- public static Connection getDBConnection() {
- Connection dbConnection = null;
- try {
- Class.forName(DB_DRIVER);
- } catch (ClassNotFoundException e) {
- System.out.println(e.getMessage());
- }
- try {
- dbConnection = DriverManager.getConnection(DB_CONNECTION, DB_USER,DB_PASSWORD);
- return dbConnection;
- } catch (SQLException e) {
- System.out.println(e.getMessage());
- }
- return dbConnection;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement