Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Created by Casvan on 8-3-2016.
- */
- import java.sql.Connection;
- import java.sql.DriverManager;
- /**
- *
- * @author Casvan
- */
- public class DatabaseConnector {
- private static Connection connection = null;
- public DatabaseConnector(){
- }
- public Connection connectToDatabase() {
- //IP ADRES FROM DATABASE
- //String url = "jdbc:mysql://localhost:3306/";
- try {Class.forName("org.postgresql.Driver");
- } catch (ClassNotFoundException e) {
- System.out.println("Where is your PostgreSQL JDBC Driver? "
- + "Include in your library path!");
- e.printStackTrace();
- }
- try {
- connection = DriverManager.getConnection(
- "jdbc:postgresql://localhost:8080/Verplaatsingsysteem", "postgres",
- "fontys");
- } catch (Exception e) {
- return null;
- }
- return connection;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement