Delete 'AndroidStudio_projects/app/src/main/java/com/example/hamburger/utils/JDBCUtils.java'

develop
pgo4rwty6 2 years ago
parent 255309e0a3
commit 591c0d9df4

@ -1,37 +0,0 @@
package com.example.hamburger.utils;
import java.sql.Connection;
import java.sql.DriverManager;
/**
* function
*/
public class JDBCUtils {
private static final String TAG = "mysql-party-JDBCUtils";
private static String driver = "com.mysql.jdbc.Driver";// MySql驱动
private static String dbName = "party";// 数据库名称
private static String user = "rootes";// 用户名
private static String password = "123456";// 密码
public static Connection getConn(){
Connection connection = null;
try{
Class.forName(driver);// 动态加载类
String ip = "192.168.43.7";// 写成本机地址不能写成localhost同时手机和电脑连接的网络必须是同一个
// 尝试建立到给定数据库URL的连接
connection = DriverManager.getConnection("jdbc:mysql://" + ip + ":3306/" + dbName,
user, password);
}catch (Exception e){
e.printStackTrace();
}
return connection;
}
}
Loading…
Cancel
Save