Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class SQLConnection
- {
- Connection conn;//default Connection
- String url;
- Settings settings;
- public SQLConnection()throws InstantiationException, IllegalAccessException
- {
- settings = new ReadWrite().readIn();
- try {
- Class.forName("com.mysql.jdbc.Driver").newInstance();//Specifys the package to use
- url = "jdbc:mysql://homepages.cs.ncl.ac.uk:3306/t2015t21"; //+ settings.getDBadr() + "/" + settings.getDBname();
- conn = DriverManager.getConnection("jdbc:mysql://homepages.cs.ncl.ac.uk:3306/t2015t21");//,"t2015t21", "CubFur?%");//settings.getDBusername(),settings.getDBpassword());//Makes the connection with the given parameters
- }catch (ClassNotFoundException e)
- {
- System.out.println("A ClassNotFound exception occured! Unrecoverable error, terminating server application.");
- System.exit(1);
- }
- catch(SQLException e)
- {
- System.out.println("An SQL exception occured!\n"+ e.toString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement