parent
3129d3bf5a
commit
68e331caac
Binary file not shown.
@ -1,16 +1,26 @@
|
||||
package com.example.leudaemialikeme.Activity;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.example.leudaemialikeme.R;
|
||||
|
||||
public class SendQuestionActivity extends AppCompatActivity {
|
||||
public class SendQuestionActivity extends AppCompatActivity implements View.OnClickListener{
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_send_question);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.example.leudaemialikeme;
|
||||
package com.example.leudaemialikeme.Bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.example.leudaemialikeme;
|
||||
package com.example.leudaemialikeme.Bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.example.leudaemialikeme;
|
||||
package com.example.leudaemialikeme.Bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.example.leudaemialikeme;
|
||||
package com.example.leudaemialikeme.Bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.example.leudaemialikeme;
|
||||
package com.example.leudaemialikeme.Bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.example.leudaemialikeme;
|
||||
package com.example.leudaemialikeme.Bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -0,0 +1,60 @@
|
||||
package com.example.leudaemialikeme.Bean;
|
||||
|
||||
public class User {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private int uid;
|
||||
private int id;
|
||||
private String username;
|
||||
private String name;
|
||||
private String phone;
|
||||
private String password;
|
||||
|
||||
public int getUid(){
|
||||
return uid;
|
||||
}
|
||||
public void setUid(int uid){
|
||||
this.uid=uid;
|
||||
}
|
||||
public void setId(int id){
|
||||
this.id=id;
|
||||
}
|
||||
public int getId(){
|
||||
return id;
|
||||
}
|
||||
public void setUsername(String username){
|
||||
this.username=username;
|
||||
}
|
||||
public String getUsername(){
|
||||
return username;
|
||||
}
|
||||
public void setName(String name){
|
||||
this.name=name;
|
||||
}
|
||||
public String getName(){
|
||||
return name;
|
||||
}
|
||||
public void setPhone(String phone){
|
||||
this.phone=phone;
|
||||
}
|
||||
public String getPhone(){
|
||||
return phone;
|
||||
}
|
||||
public void setPassword(String password){
|
||||
this.password=password;
|
||||
}
|
||||
public String getPassword(){
|
||||
return password;
|
||||
}
|
||||
public User(int uid,int id,String username,String name, String phone,String password){
|
||||
this.uid=uid;
|
||||
this.id=id;
|
||||
this.username=username;
|
||||
this.name=name;
|
||||
this.phone=phone;
|
||||
this.password=password;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,56 @@
|
||||
package com.example.leudaemialikeme.Utils;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
|
||||
public class DBUtils {
|
||||
|
||||
private final static String driver = "com.mysql.jdbc.Driver";
|
||||
private final static String url = "jdbc:mysql://192.168.80.1:3306/leukemia?serverTimezone=UTC";
|
||||
|
||||
private final static String username = "root";
|
||||
private final static String password = "123456";
|
||||
|
||||
Connection conn=null;
|
||||
Statement st=null;
|
||||
ResultSet rs=null;
|
||||
|
||||
static {
|
||||
try {
|
||||
Class.forName(driver);
|
||||
Log.v("mysql","加载驱动成功");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Log.e("mysql","加载驱动错误");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//2. 获取连接
|
||||
public static Connection getConnect() throws Exception {
|
||||
Connection conn=DriverManager.getConnection(url, username, password);
|
||||
Log.v("mysql","成功获取数据库");
|
||||
return conn;
|
||||
}
|
||||
|
||||
//3. 释放连接资源
|
||||
|
||||
public static void release(Connection conn, Statement st, ResultSet rs) throws Exception {
|
||||
if (rs != null) {
|
||||
rs.close();
|
||||
}
|
||||
if (st != null) {
|
||||
st.close();
|
||||
}
|
||||
if (conn != null) {
|
||||
conn.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in new issue