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 be.howest.ti.moviebase.data.util;
- import be.howest.ti.moviebase.util.MovieException;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- /**
- *
- * @author frederic.vlummens
- */
- public class MySqlConnection
- {
- private static final String URL = "jdbc:mysql://localhost/moviebase?useSSL=false"; // database path connection
- private static final String UID = "root";
- private static final String PWD = "";
- // loading the class is only required for web applications
- static
- {
- try
- {
- Class.forName("com.mysql.jdbc.Driver");
- }
- catch (ClassNotFoundException ex)
- {
- throw new MovieException("Unable to load database driver.", ex);
- }
- }
- public static Connection getConnection() throws SQLException
- {
- return DriverManager.getConnection(URL, UID, PWD);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement