无法打开数据库/无法更改区域设置(数据库)以“EN

编程入门 行业动态 更新时间:2024-10-26 02:24:13
本文介绍了无法打开数据库/无法更改区域设置(数据库)以“EN_US”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经读Failed改变区域设置DB/data/data/my.easymedi.controller/databases/EasyMediInfo.db到EN_US但它不帮助我。我仍然有同样的错误。

I have read solution from Failed to change locale for db '/data/data/my.easymedi.controller/databases/EasyMediInfo.db' to 'en_US' but it doesnt help me. I still have the same error.

这些是我的 DBHelper 类。你可以看看,并帮助我?

These is my DBHelper class. Could you look into it and help me?

package com.example.mgr; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.sql.Date; import java.util.ArrayList; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteException; import android.database.sqlite.SQLiteOpenHelper; public class DBHelper extends SQLiteOpenHelper{ //The Android's default system path of your application database. private static String DB_PATH = "/data/data/com.example.mgr/databases/"; private static String DB_NAME = "Mgr.Test.db"; private SQLiteDatabase myDataBase; private final Context myContext; public static final String KEY_ROWID = "_id"; public static final String KEY_DATE = "DataWstawiena"; public static final String KEY_TRESC = "Tresc"; public static final String DATABASE_NAME = "Mgr.Test"; public static final String DATABASE_TABLE = "InformacjeZDziekanatu"; private static int DATABASE_VERSION = 18; /** * Constructor * Takes and keeps a reference of the passed context in order to access to the application assets and resources. * @param context */ public DBHelper(Context context) { super(context, DB_NAME, null, DATABASE_VERSION); System.out.println("------Odpalam DBHelpera---wolane z konstruktora----"); this.myContext = context; } /** * Creates a empty database on the system and rewrites it with your own database. * */ public void createDataBase() throws IOException{ boolean dbExist = checkDataBase(); System.out.println("----Baza istnieje: " + dbExist + "-----"); if(dbExist){ System.out.println("----Baza istnieje!"); this.getReadableDatabase(); System.out.println("----Baza istnieje! znow"); //do nothing - database already exist } dbExist = checkDataBase(); if(!dbExist){ System.out.println("----Baza nie istnieje"); //By calling this method and empty database will be created into the default system path //of your application so we are gonna be able to overwrite that database with our database. this.getReadableDatabase(); try { System.out.println("Bede kopiowal"); copyDataBase(); } catch (IOException e) { throw new Error("Error copying database"); } } } /** * Check if the database already exist to avoid re-copying the file each time you open the application. * @return true if it exists, false if it doesn't */ private boolean checkDataBase(){ SQLiteDatabase checkDB = null; System.out.println("----Baza istnieje w checkDB!"); try{ String myPath = DB_PATH + DB_NAME; checkDB = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.NO_LOCALIZED_COLLATORS|SQLiteDatabase.OPEN_READONLY); System.out.println("Bazka otwarta!"); }catch(SQLiteException e){ System.out.println("database does't exist yet"); } if(checkDB != null){ System.out.println("Zamykam baze"); checkDB.close(); } return checkDB != null ? true : false; } /** * Copies your database from your local assets-folder to the just created empty database in the * system folder, from where it can be accessed and handled. * This is done by transfering bytestream. * */ private void copyDataBase() throws IOException{ //Open your local db as the input stream InputStream myInput = myContext.getAssets().open(DB_NAME); // Path to the just created empty db String outFileName = DB_PATH + DB_NAME; //Open the empty db as the output stream OutputStream myOutput = new FileOutputStream(outFileName); //transfer bytes from the inputfile to the outputfile byte[] buffer = new byte[1024]; int length; while ((length = myInput.read(buffer))>0){ myOutput.write(buffer, 0, length); } //Close the streams myOutput.flush(); myOutput.close(); myInput.close(); } public SQLiteDatabase openDataBase() throws SQLException{ String myPath = DB_PATH + DB_NAME; myDataBase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.NO_LOCALIZED_COLLATORS|SQLiteDatabase.OPEN_READONLY); return myDataBase; } @Override public synchronized void close() { if(myDataBase != null) myDataBase.close(); super.close(); } @Override public void onCreate(SQLiteDatabase db) { } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { try { copyDataBase(); } catch (IOException e) { e.printStackTrace(); } System.out.println(" ----Jestem w mtodzie onUpgrade------"); //DATABASE_VERSION++; } /** * Wykonuje zapytanie SQL * @param query - zapytanie SQL * @return zwraca Stringa z rezultatem */ public String executeQuery(String query){ String result = ""; Cursor cursor = myDataBase.rawQuery(query, null); String dataWs ="Data Wstawienia "; String tresc = "Tresc"; result = dataWs + tresc + "\n"; if(cursor.moveToFirst()) { do { result += cursor.getString(1) +" "+ cursor.getString(3)+"\n"; }while(cursor.moveToNext()); } return result; } /** * Wykonuje zapytanie SQL i zwraca tablice * @param query - zapytanie SQL * @return zwraca tablie Stringa z rezultatem */ public ArrayList<String> executeQueryTab(String query){ ArrayList<String> result = new ArrayList<String>(); Cursor cursor = myDataBase.rawQuery(query, null); String dataWs ="Data Wstawienia "; String tresc = "Tresc"; result.add(dataWs + tresc); if(cursor.moveToFirst()) { do { result.add(cursor.getString(1) +" "+ cursor.getString(3)); }while(cursor.moveToNext()); } return result; } // Add your public helper methods to access and get content from the database. // You could return cursors by doing "return myDataBase.query(....)" so it'd be easy // to you to create adapters for your views. }

它完美工作之前,但我已经做数据库一些升级,然后它停止工作。我想,这是这个错误的根源,但我不知道。

It worked perfectly before but I have made some upgrades of database and then it stopped work. I guess that this is the source of this error but I am not sure.

在此先感谢!

在您的要求:

我有打电话CreateDatabase方法在我的 MainActivity 类,你可以看到如下:

I have call createDataBase method in my MainActivity class, as you can see below:

package com.example.mgr; import java.io.IOException; import java.util.ArrayList; import android.app.Activity; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.preference.PreferenceManager; import android.view.Gravity; import android.view.View; import android.view.View.OnClickListener; import android.widget.Adapter; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { SharedPreferences preferences; TextView tv; Adapter adapter; SQLiteDatabase as; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button infDlaStudButton = (Button) findViewById(R.id.infDlaStud); Button infDlaKandButton = (Button) findViewById(R.id.infDlaKand); preferences = PreferenceManager.getDefaultSharedPreferences(this); DBHelper myDbHelper = new DBHelper(this); infDlaStudButton.setOnClickListener(this); infDlaKandButton.setOnClickListener(this); infDlaKandButton.setOnClickListener(new OnClickListener() { public void onClick(View arg0) { ble(); } }); infDlaStudButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { ble(); } }); try { myDbHelper.createDataBase(); System.out.println("Stworzyłam bazę danych"); } catch (IOException ioe) { throw new Error("nie moge to create database"); } System.out.println("bede otwierdal baze danych w glowej metodzie"); myDbHelper.openDataBase(); } void ble() { Intent intent = new Intent(); intent.setClass(MainActivity.this, SecondActivity.class); startActivity(intent); } @Override public void onClick(View arg0) { Toast.makeText(this, "ble", Toast.LENGTH_LONG).show(); // TODO Auto-generated method stub } }

是的,在 android_metadata 表存在于数据库中,并有* EN_US *的价值。

Yes, the android_metadata table exist in the database and has '*en_US*' value.

我已创建新的,非常简单的数据库 Drzewo.db 。当这个表只有2个表: andoid_metadata 和另一个( Przyjeci ),那么一切正常!但后来我加入了新表,并设法使升级和我有同样的错误。

I have create new, very simple database Drzewo.db. When this table has only 2 tables: andoid_metadata and another one (Przyjeci) then everything works! But later I have added new table and tried to make an upgrade and I have the same error.

有我的登录(从这个新的数据库):

There are my logs (from this new database):

12-04 19:58:41.959: E/SQLiteLog(2293): (11) database corruption at line 50741 of [00bb9c9ce4] 12-04 19:58:41.959: E/SQLiteLog(2293): (11) database corruption at line 50780 of [00bb9c9ce4] 12-04 19:58:41.969: E/SQLiteLog(2293): (11) statement aborts at 16: [SELECT locale FROM android_metadata UNION SELECT NULL ORDER BY locale DESC LIMIT 1] 12-04 19:58:42.056: E/SQLiteDatabase(2293): Failed to open database '/data/data/com.example.mgr/databases/Drzewo.db'. 12-04 19:58:42.056: E/SQLiteDatabase(2293): android.database.sqlite.SQLiteException: Failed to change locale for db '/data/data/com.example.mgr/databases/Drzewo.db' to 'en_US'. 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteConnection.setLocaleFromConfiguration(SQLiteConnection.java:386) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:218) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:854) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:229) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at com.example.mgr.DBHelper.createDataBase(DBHelper.java:53) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at com.example.mgr.MainActivity.onCreate(MainActivity.java:73) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.app.Activity.performCreate(Activity.java:5104) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.app.ActivityThread.access$600(ActivityThread.java:141) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.os.Handler.dispatchMessage(Handler.java:99) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.os.Looper.loop(Looper.java:137) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.app.ActivityThread.main(ActivityThread.java:5041) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at java.lang.reflect.Method.invokeNative(Native Method) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at java.lang.reflect.Method.invoke(Method.java:511) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at dalvik.system.NativeStart.main(Native Method) 12-04 19:58:42.056: E/SQLiteDatabase(2293): Caused by: android.database.sqlite.SQLiteDatabaseCorruptException: database disk image is malformed (code 11) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteConnection.nativeExecuteForString(Native Method) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:634) 12-04 19:58:42.056: E/SQLiteDatabase(2293): at android.database.sqlite.SQLiteConnection.setLocaleFromConfiguration(SQLiteConnection.java:367) 12-04 19:58:42.056: E/SQLiteDatabase(2293): ... 28 more 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): Couldn't open Drzewo.db for writing (will try read-only): 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): android.database.sqlite.SQLiteException: Failed to change locale for db '/data/data/com.example.mgr/databases/Drzewo.db' to 'en_US'. 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteConnection.setLocaleFromConfiguration(SQLiteConnection.java:386) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:218) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteConnection.open(SQLiteConnection.java:193) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteConnectionPool.openConnectionLocked(SQLiteConnectionPool.java:463) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:185) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteConnectionPool.open(SQLiteConnectionPool.java:177) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteDatabase.openInner(SQLiteDatabase.java:804) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteDatabase.open(SQLiteDatabase.java:789) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteDatabase.openDatabase(SQLiteDatabase.java:694) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.app.ContextImpl.openOrCreateDatabase(ContextImpl.java:854) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.content.ContextWrapper.openOrCreateDatabase(ContextWrapper.java:229) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:224) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at com.example.mgr.DBHelper.createDataBase(DBHelper.java:53) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at com.example.mgr.MainActivity.onCreate(MainActivity.java:73) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.app.Activity.performCreate(Activity.java:5104) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.app.ActivityThread.access$600(ActivityThread.java:141) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.os.Handler.dispatchMessage(Handler.java:99) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.os.Looper.loop(Looper.java:137) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.app.ActivityThread.main(ActivityThread.java:5041) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at java.lang.reflect.Method.invokeNative(Native Method) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at java.lang.reflect.Method.invoke(Method.java:511) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at dalvik.system.NativeStart.main(Native Method) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): Caused by: android.database.sqlite.SQLiteDatabaseCorruptException: database disk image is malformed (code 11) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteConnection.nativeExecuteForString(Native Method) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteConnection.executeForString(SQLiteConnection.java:634) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): at android.database.sqlite.SQLiteConnection.setLocaleFromConfiguration(SQLiteConnection.java:367) 12-04 19:58:42.219: E/SQLiteOpenHelper(2293): ... 28 more 12-04 19:58:42.259: D/AndroidRuntime(2293): Shutting down VM 12-04 19:58:42.280: W/dalvikvm(2293): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 12-04 19:58:42.359: E/AndroidRuntime(2293): FATAL EXCEPTION: main 12-04 19:58:42.359: E/AndroidRuntime(2293): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.mgr/com.example.mgr.MainActivity}: android.database.sqlite.SQLiteException: Can't upgrade read-only database from version 5 to 6: Drzewo.db 12-04 19:58:42.359: E/AndroidRuntime(2293): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180) 12-04 19:58:42.359: E/AndroidRuntime(2293): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230) 12-04 19:58:42.359: E/AndroidRuntime(2293): at android.app.ActivityThread.access$600(ActivityThread.java:141) 12-04 19:58:42.359: E/AndroidRuntime(2293): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234) 12-04 19:58:42.359: E/AndroidRuntime(2293): at android.os.Handler.dispatchMessage(Handler.java:99) 12-04 19:58:42.359: E/AndroidRuntime(2293): at android.os.Looper.loop(Looper.java:137) 12-04 19:58:42.359: E/AndroidRuntime(2293): at android.app.ActivityThread.main(ActivityThread.java:5041) 12-04 19:58:42.359: E/AndroidRuntime(2293): at java.lang.reflect.Method.invokeNative(Native Method) 12-04 19:58:42.359: E/AndroidRuntime(2293): at java.lang.reflect.Method.invoke(Method.java:511) 12-04 19:58:42.359: E/AndroidRuntime(2293): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 12-04 19:58:42.359: E/AndroidRuntime(2293): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 12-04 19:58:42.359: E/AndroidRuntime(2293): at dalvik.system.NativeStart.main(Native Method) 12-04 19:58:42.359: E/AndroidRuntime(2293): Caused by: android.database.sqlite.SQLiteException: Can't upgrade read-only database from version 5 to 6: Drzewo.db 12-04 19:58:42.359: E/AndroidRuntime(2293): at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:245) 12-04 19:58:42.359: E/AndroidRuntime(2293): at android.database.sqlite.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:188) 12-04 19:58:42.359: E/AndroidRuntime(2293): at com.example.mgr.DBHelper.createDataBase(DBHelper.java:53) 12-04 19:58:42.359: E/AndroidRuntime(2293): at com.example.mgr.MainActivity.onCreate(MainActivity.java:73) 12-04 19:58:42.359: E/AndroidRuntime(2293): at android.app.Activity.performCreate(Activity.java:5104) 12-04 19:58:42.359: E/AndroidRuntime(2293): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080) 12-04 19:58:42.359: E/AndroidRuntime(2293): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144) 12-04 19:58:42.359: E/AndroidRuntime(2293): ... 11 more

我在上班的蚀的* JUNO * +的的Andr​​oid 4.2.2 的

I work on eclipse *juno* + Android 4.2.2

推荐答案

大概是数据库文件实际上是损坏。 你可以尝试打开它 sqlitebrowser

Probably the database file is actually corrupted. You can try to open it with sqlitebrowser

另外,还可以做一些其他的检查,并尝试将它的情况下恢复已损坏,如果您在计算机中安装的SQLite。您可以按照此步骤操作:

Also, you can do some other checks and try to restore it in case it is corrupted, if you install sqlite in your computer. You can follow this steps:

  • 在获取此处源码并安装它
  • 开启命令的SQLite oyour environnment变量路径添加路径,让您可以启动sqlite的命令处处
  • 进入该目录,其中有数据库,并启动SQLite的:

  • Get sqlite here and install it
  • Open command a add path to sqlite oyour environnment variable path to allow you to launch sqlite commands everywhere
  • Go to the directory, where you have the database, and launch SQLite: sqlite3 yourfile.db

  • 您可以通过检查数据库的完整性:

  • You can check the database integrity by:

    pragma integrity_check;

  • 如果它说,该文件是确定的,那么我们就输了!如果已损坏,让试图恢复它。

  • If it says that the file is ok, then we are lost! If it is corrupted, lets try to restore it.

    有时,损坏的sqlite3的数据库,最好的解决办法是简单而有效:转储和恢复

    Sometimes the best solution for a corrupted sqlite3 database is simple yet effective: Dump and Restore

  • 您的数据导出到一个SQL文件:

  • Export your data to an sql file: echo .dump | sqlite3.exe yourdbname.db > yourdbname.sql

  • 更改文件名MV yourdbname.db yourdbname.db.original

  • Change file name mv yourdbname.db yourdbname.db.original

    用SQL创建一个新的数据库。

    Create a new database with your sql.

    sqlite3.exe -init yourdbname.sql yourdbname.db

  • 打开使用SQLite浏览器的新文件,看看会发生什么!

  • Open the new file with sqlite browser, and see what happens!

  • 更多推荐

    无法打开数据库/无法更改区域设置(数据库)以“EN

    本文发布于:2023-11-13 01:37:43,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1583053.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:数据库   无法打开   区域   EN

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!