I am using GreenDAO library
I have facing SQL exception, after upgrade from older version to new
Example:
Version 1.0 : database is not encrypted
Version 2.0 : database is encrypted
existing users using 1.0 upgraded to 2.0
I getting exception after calling this, before this I have to encrypt older database on upgrade. How to do this?
helper.getEncryptedWritableDb(password);
net.sqlcipher.database.SQLiteException: file is encrypted or is not a database: , while compiling: select count(*) from sqlite_master;
at net.sqlcipher.database.SQLiteCompiledSql.native_compile(Native Method)
at net.sqlcipher.database.SQLiteCompiledSql.compile(SQLiteCompiledSql.java:91)
at net.sqlcipher.database.SQLiteCompiledSql.<init>(SQLiteCompiledSql.java:64)
at net.sqlcipher.database.SQLiteProgram.<init>(SQLiteProgram.java:84)
at net.sqlcipher.database.SQLiteQuery.<init>(SQLiteQuery.java:49)
at net.sqlcipher.database.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:42)
at net.sqlcipher.database.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1820)
at net.sqlcipher.database.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1785)
at net.sqlcipher.database.SQLiteDatabase.keyDatabase(SQLiteDatabase.java:2439)
at net.sqlcipher.database.SQLiteDatabase.openDatabaseInternal(SQLiteDatabase.java:2368)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1149)
at net.sqlcipher.database.SQLiteDatabase.openDatabase(SQLiteDatabase.java:1041)
at net.sqlcipher.database.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:249)
at net.sqlcipher.database.SQLiteOpenHelper.getReadableDatabase(SQLiteOpenHelper.java:214)
at org.greenrobot.greendao.database.DatabaseOpenHelper.getEncryptedWritableDb(DatabaseOpenHelper.java:134)
at org.broadsoft.iris.datamodel.db.DatabaseManager.openWritableDb(DatabaseManager.java:149)
at org.broadsoft.iris.datamodel.db.DatabaseManager.openReadableDb(DatabaseManager.java:129)
at org.broadsoft.iris.datamodel.db.DatabaseManager.getContactIdsInMessageHistory(DatabaseManager.java:461)
at org.broadsoft.iris.http.HttpManagerV2.lambda$fetchVCards$2(HttpManagerV2.java:573)
at org.broadsoft.iris.http.HttpManagerV2.access$lambda$2(HttpManagerV2.java)
at org.broadsoft.iris.http.HttpManagerV2$$Lambda$3.run(Unknown Source)
at java.lang.Thread.run(Thread.java:761)
There is no "upgrade" from SQLite (unencrypted) to SQLCipher (encrypted). This is an outline how to do it:
Open SQLite DB
Open SQLCipher DB with different name to ensure a different DB file is used
Read data from SQLite
Write data to SQLCipher
Related
I am new to Hibernate. Using the 5.2.10 FINAL version connecting to Oracle 11g using the Oracle10gDialect with JPA 2.1 and ojdbc8.jar
I try to access a simple stored procedure taking a String input parameter and output a Oracle SYS_REFCURSOR.
StoredProcedureQuery call = session.createStoredProcedureCall("sp_get_profile");
call.registerStoredProcedureParameter(1, String.class, ParameterMode.IN);
call.registerStoredProcedureParameter(2, Class.class, ParameterMode.REF_CURSOR);
call.execute();
An exception occur when I access the function
ERROR SqlExceptionHelper Invalid column type: 2012
DatabaseException::error=[Error registering REF_CURSOR parameter [2]]
I try to write a simple program connecting to DB with the Oracle Driver only. I will have the same error if I register Types.REF_CUSOR as the output parameter to CallableStatement.
cs.registerOutParameter(2, Types.REF_CURSOR);
And the problem can be solved by changing to OracleTypes
cs.registerOutParameter(2, OracleTypes.CURSOR);
Anyone know what is wrong? I need to fall back to use the traditional SQL programming if I cannot get the stored procedure access success. . . please help.
Finally got it work, I should check the Oracle JDBC document first before implementation.
ojdbc8 should be good for Oracle 12c + JDK8 + JPA2.1 with Oracle12cDialect.
For Oracle 11g, need to use ojdbc6.jar
I solved that issue by debugging OJDBC and Hibernate, the building from sources a patched Hibernate CORE library (5.4.15-Final).
I have patched the method ExtractedDatabaseMetaDataImpl.supportsRefCursors which returns always false.
As per my requirement i need to create a edmx file and establish a connection to sql server thats residing in a remote server and am following the VS 2013 , and using wizard model am trying to connect to DB.
But its throwing the error:
what am I missing, do i need set any settings / some installables?
Firstly i am getting the sqlclr types error, so i installed the same and other error was sharedmanagementobjects error, so i installed that msi as well.
my sql server is SQL SERVER 2012 STD - SP2,VERSION NUMBER : 11.0.5058
Loading metadata from the database took 00:00:03.2592313.
Generating the model took 00:00:03.1761556.
Could not save the XML to the configuration file 'D:\PoCSolutions\EDMXTEST_WINFORMS1\EDMXTEST_WINFORMS1\App.config' because of the error 'Access to the path 'D:\PoCSolutions\EDMXTEST_WINFORMS1\EDMXTEST_WINFORMS1\App.config' is denied.'.
Unable to update the App.Config file because of the following exception: 'Access to the path 'D:\PoCSolutions\EDMXTEST_WINFORMS1\EDMXTEST_WINFORMS1\App.config' is denied.'
Writing the .edmx file took 00:00:00.0009981.
I am getting this error when trying to create a new .edmx file using VS 2013 with Entity Framework 5.0
acess-denied-edmx-5.0-VS2013
I'm having trouble restoring an OrientDB database from a backup. I'm using OrientDB version 1.2.0 (this backup is from November 2012) and the backup was produced by OrientDB (same version) using the built-in backup utility. I'm trying to restore the backup to a new database using the OrientDB console:
create database remote:localhost/dbname root password local graph
import database backup.json
But when I run those commands, I get the following error in the console:
Importing indexes ...
- Index 'dictionary'...Error on database import happened just before line 22258, column 6
com.orientechnologies.orient.core.exception.OConcurrentModificationException: Cannot update record #0:1 in storage 'dbname' because the version is not the latest. Probably you are updating an old record or it has been modified by another user (db=v2 your=v1)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.createException(OChannelBinary.java:429)
at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinary.handleStatus(OChannelBinary.java:382)
at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:145)
at com.orientechnologies.orient.enterprise.channel.binary.OChannelBinaryAsynch.beginResponse(OChannelBinaryAsynch.java:59)
at com.orientechnologies.orient.client.remote.OStorageRemote.beginResponse(OStorageRemote.java:1556)
at com.orientechnologies.orient.client.remote.OStorageRemote.command(OStorageRemote.java:727)
at com.orientechnologies.orient.client.remote.OStorageRemoteThread.command(OStorageRemoteThread.java:191)
at com.orientechnologies.orient.core.command.OCommandRequestTextAbstract.execute(OCommandRequestTextAbstract.java:60)
at com.orientechnologies.orient.core.index.OIndexManagerRemote.dropIndex(OIndexManagerRemote.java:80)
at com.orientechnologies.orient.core.index.OIndexManagerProxy.dropIndex(OIndexManagerProxy.java:80)
at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importIndexes(ODatabaseImport.java:687)
at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importDatabase(ODatabaseImport.java:127)
at com.orientechnologies.orient.console.OConsoleDatabaseApp.importDatabase(OConsoleDatabaseApp.java:1419)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.orientechnologies.common.console.OConsoleApplication.execute(OConsoleApplication.java:238)
at com.orientechnologies.common.console.OConsoleApplication.executeCommands(OConsoleApplication.java:127)
at com.orientechnologies.common.console.OConsoleApplication.run(OConsoleApplication.java:92)
at com.orientechnologies.orient.console.OConsoleDatabaseApp.main(OConsoleDatabaseApp.java:130)
All of the records import correctly, but it fails on the indexes. I have 15+ backups of the same database and they all have this issue, so it seems unlikely that they're all corrupted. How can I restore my database? (I'm OK with having to modify the JSON if needbe.)
When trying to use local mode rather than remote mode, I get a different error:
Started import of database 'local:dbname' from dbname.json...
Importing database info...OK
Importing clusters...
- Creating cluster 'internal'...OK, assigned id=0
- Creating cluster 'default'...Error on database import happened just before line 13, column 52
com.orientechnologies.orient.core.exception.OConfigurationException: Imported cluster 'default' has id=3 different from the original: 2. To continue the import drop the cluster 'manindex' that has 1 records
at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importClusters(ODatabaseImport.java:544)
at com.orientechnologies.orient.core.db.tool.ODatabaseImport.importDatabase(ODatabaseImport.java:130)
at com.orientechnologies.orient.console.OConsoleDatabaseApp.importDatabase(OConsoleDatabaseApp.java:1414)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.orientechnologies.common.console.OConsoleApplication.execute(OConsoleApplication.java:269)
at com.orientechnologies.common.console.OConsoleApplication.executeCommands(OConsoleApplication.java:157)
at com.orientechnologies.common.console.OConsoleApplication.run(OConsoleApplication.java:97)
at com.orientechnologies.orient.graph.console.OGremlinConsole.main(OGremlinConsole.java:53)
Error: com.orientechnologies.orient.core.db.tool.ODatabaseExportException: Error on importing database 'dbname' from file: dbname.json
Error: com.orientechnologies.orient.core.exception.OConfigurationException: Imported cluster 'default' has id=3 different from the original: 2. To continue the import drop the cluster 'manindex' that has 1 records
It seems like the issue is that my old cluster IDs don't match the ones in the new database. Perhaps there are creation options that affect which clusters are created by default?
It turns out that the issue was that the database was being imported with OrientDB version 1.2.0 but was created with 1.0.1 (or 1.0.0). The JSON file listed version 1.2.0 as the engine-version, but that was the engine that backed it up, not created it. After I tried Lvca's suggestion of using local mode, I discovered that the cluster IDs weren't matching up. From there I guessed that the version numbers might not be correct. So it seems that even though I was running the database using the 1.2.0 server and the 1.2.0 Java library, the database was never "upgraded" to use the new 1.2.0 schema.
Thanks to Lvca for a nudge in the right direction.
I have a app that is using a prepopulated database - following the instructions from here:
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
The app is working fine on Android 4.1, 4.3, 5.0, 5.1 - however on 4.0.3 and 4.0 it crashes with
E/SqliteDatabaseCpp(551): SELECT locale FROM android_metadata failed
E/SQLiteDatabase(551): Failed to open the database. closing it.
E/SQLiteDatabase(551): android.database.sqlite.SQLiteException: no such table: android_metadata
I've double checked and the metadata table has been created on the database as per the article.
The error is being generated from:
myDataBase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
I've read similar threads and guys have got around this error using SQLiteDatabase.NO_LOCALIZED_COLLATORS if they did not have the android_metadata table created.
I have tried the above - same error.
Here is the snippet of code:
private static String DB_PATH = "/data/data/org.example/databases/";
private static String DB_NAME = "model_paint_conversion.db";
myDataBase = SQLiteDatabase.openDatabase(myPath, null, SQLiteDatabase.OPEN_READONLY);
Have also tried removing the path - I then get a error copying the database.
Any idea what it crashes on 4.0 and 4.0.3 but works on the other versions?
After some more digging around - viewed the db file that is copied to the emulator and found the metadata table was indeed missing. Very odd - I def created it.
Now recreated it and its working.
try SQLiteDatabase.NO_LOCALIZED_COLLATORS with SQLiteDatabase.OPEN_READONLY and add uses permission for WRITE_SETTINGS in manifest.
I had a same problem and I did like this and worked for me...
Whenever I connect to HSQLDB from my application deployed on JBoss 5.1, it throws exception as : Caused by: org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (java.sql.SQLException: error in script file line: 1 Unexpected token UNIQUE, requires COLLATION in statement [SET DATABASE UNIQUE]) .
My HSQLDB script file reads something as below :
`SET DATABASE UNIQUE NAME HSQLDB2E0BAD63B3
SET DATABASE GC 0
SET DATABASE DEFAULT RESULT MEMORY ROWS 0
SET DATABASE EVENT LOG LEVEL 0
.....`
Does anyone have idea what thos exception means or should I change something in my HSQLDB configuration?
Regards,
Satya
Your database files are created with version 2.x, but the version of database engine running on JBoss 5.1 is 1.8.x. You should be able to replace the hsqldb.jar in the JBoss configuration with a new version.