Last active
December 30, 2015 00:19
-
-
Save ayato-p/7749088 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package database.util; | |
import com.sun.org.apache.xerces.internal.dom.PSVIAttrNSImpl; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.SQLException; | |
/** | |
* Created with IntelliJ IDEA. | |
* User: ayato | |
* Date: 12/2/13 | |
* Time: 9:07 PM | |
* To change this template use File | Settings | File Templates. | |
*/ | |
public final class DatabaseUtil { | |
public static Connection newConnection() { | |
Connection con = null; | |
try { | |
Class.forName("com.mysql.jdbc.Driver"); | |
con = DriverManager.getConnection("jdbc:mysql://localhost/exercise", "root", "pass"); | |
} catch (SQLException e) { | |
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. | |
} catch (ClassNotFoundException e) { | |
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. | |
} | |
return con; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment