You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
708 B
28 lines
708 B
package support;
|
|
import java.sql.Connection;
|
|
import java.sql.DriverManager;
|
|
|
|
|
|
public class ConnectionSql {
|
|
String driver="com.mysql.jdbc.Driver";
|
|
String url;
|
|
String user="root";
|
|
String password="mysql";
|
|
public ConnectionSql(String sqlName) {
|
|
// TODO Auto-generated constructor stub
|
|
url="jdbc:mysql://127.0.0.1:3306/"+sqlName+"?useUnicode=true&charsetEncoding=utf8&useCursorFetch=true&defaultFetchSize=100";
|
|
// url="jdbc:mysql://127.0.0.1:3306/"+sqlName;
|
|
}
|
|
public Connection connection(){
|
|
Connection conn=null;
|
|
try{
|
|
Class.forName(driver);
|
|
conn=DriverManager.getConnection(url, user, password);
|
|
}catch (Exception e) {
|
|
// TODO: handle exception
|
|
e.printStackTrace();
|
|
}
|
|
return conn;
|
|
}
|
|
}
|