连接数据库,但是很慢

my
盛洁 5 years ago
parent ec37334197
commit 8c9e35e668

@ -1,29 +1,8 @@
package hunnu.sj.raise_money.DataBase; package hunnu.sj.raise_money.DataBase;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;
import android.provider.ContactsContract;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DriverManager; import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
public class DatabaseHelper /*extends SQLiteOpenHelper*/ {
/*static String name="user.db";
static int dbVersion=1;
public DatabaseHelper(Context context) {
super(context, name, null, dbVersion);
}
public void onCreate(SQLiteDatabase db) {
String sql="create table user(id integer primary key autoincrement,username varchar(20),password varchar(20),role varchar(20))";
db.execSQL(sql);
}
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}*/ public class DatabaseHelper {
private static DatabaseHelper db = null; private static DatabaseHelper db = null;
private static Connection conn = null; private static Connection conn = null;
public static DatabaseHelper getDb(){ public static DatabaseHelper getDb(){

@ -7,12 +7,9 @@ import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler; import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.provider.MediaStore;
import android.view.View; import android.view.View;
import android.widget.EditText; import android.widget.EditText;
import android.widget.RadioButton; import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.Toast;
import hunnu.sj.raise_money.DataBase.UserService; import hunnu.sj.raise_money.DataBase.UserService;

Loading…
Cancel
Save