连接网络上的数据库

my
盛洁 5 years ago
parent 8c9e35e668
commit edcc12fa02

@ -32,5 +32,5 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation files('libs/mysql-connector-java-5.1.39-bin.jar')
implementation files('libs\\mysql-connector-java-5.1.39-bin.jar')
}

@ -15,11 +15,11 @@ public class DatabaseHelper {
public static Connection getConnection(){
String username = "root";
String password ="";
String password ="SJ1126388959";
if(conn==null){
try {
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://172.18.22.77:3306/dogson?useSSL=true&characterEncoding=utf-8";
String url = "jdbc:mysql://139.180.223.93:3306/dogson?useSSL=true&characterEncoding=utf-8";
conn = DriverManager.getConnection(url,username,password);
return conn;
}catch(Exception e){

Loading…
Cancel
Save