Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package tiebreak.DAL;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- /**
- *
- * @author Henrik
- */
- public class TBConnection
- {
- /**
- * Create connection to the database, according to the information listed below.
- * @return
- * @throws SQLServerException
- */
- private static String serverName = "x.x.x.x";
- private static String dbName = "tie-break";
- private static int port = 3306;
- private static String user = "java";
- private static String pass = "java";
- public static Connection getConnection() throws SQLException
- {
- try
- {
- Class.forName("org.gjt.mm.mysql.Driver");
- }
- catch (Exception E)
- {
- System.err.println("Unable to load driver");
- E.printStackTrace();
- }
- Connection con = DriverManager.getConnection("jdbc:mysql://" + serverName + ":" + port + "/" + dbName, user, pass);
- return con;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement