Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Cameron Evans   on Dec 19 In Java Category.

  
Question Answered By: Maliha Malik   on Dec 19

openConnection(String username, String password, String database) {
try{
Class.forName("org.gjt.mm.mysql.Driver"); //GNU driver
}
catch (ClassNotFoundException noClass) {
System.out.println(noClass);
}
try {
connection =
DriverManager.getConnection("jdbc:mysql://localhost/databaselocation?user=" +
username + "&password=" + password);
stmt = connection.createStatement();
}

Share: 

 
 
Didn't find what you were looking for? Find more on a question regarding jdbc Or get search suggestion and latest updates.


Tagged: