Android Question (Solved) problem with jrdc and sql

TheFalcon

Active Member
Licensed User
Longtime User
Good morning, I have a problem with JRDC and SQL database on PC.
I'll tell you a little:
I have an application on Windows, and I am implementing an Android application. But I have a problem
IF I modified the SQL database on the PC, then copied it to the Mobile application, and also worked on it, I don't have any problem.

But, if I access the database Using JRDC

B4X:
DriverClass=com.sqlite.JdbcUrl
JdbcUrl=jdbc:sqlite:C:/Users/Public/Cadesoft/TCuentas.db
#SQLite spcecific. Set CreateFile to create file if it does not exist.
CreateFile=FALSE



When I start the Java server it no longer lets me access the database from the PC and tells me:

SQLiteException: file is encrypted or is not a database

But if I can access the database with applications like db browser, without problems

Does anyone know why the Java server blocks my database and leaves it as encrypted?
 

TheFalcon

Active Member
Licensed User
Longtime User
I think I already found where the problem could come from, and it is the Windows application, which once the JRDC touches the database, does not work for me with the way I work

I tried to make a clean project just for consultation by changing the connection mode

Currently it connected like this:

B4X:
        Imports Finisar.SQLite
        Conexion = New Finisar.SQLite.SQLiteConnection
        Conexion.ConnectionString = "Data Source=TCuentas.db;Version=3;"

I have tried connecting like this:

B4X:
        Imports System.Data.SQLite
        Dim Conexion As New SQLiteConnection
        Dim Conexion As String = "Data Source=" & Application.StartupPath & "\TCuentas.db;Version=3"


and I can work on both without problem
I'm going to try it over the weekend and see if that's it.
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I don't understand.
Are you using B4J and B4A to write apps to connect to jRDC2 server?

SQL database is referring to what database?

Without code or sample project, it is difficult to provide any suggestions.
 
Upvote 0

TheFalcon

Active Member
Licensed User
Longtime User
Excuse me, I have a Windows application that works with SQL, but I found the problem when connecting a Mobile application with the Windows database through JRDC.

But in the end I fixed it by modifying the connection mode in the Windows Application, apparently the one I used did not work well with the JRDC server, since it "Encrypted" the database.

I have had to modify the way of working in the database in the Windows program, and now it works for me, changing the connection mode with the example above. I don't know if it will be the most viable option, but I couldn't find another solution.

Thanks for your attention :)
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
I guessed you are talking about VB.NET, not B4J. I think jRDC2 is not working with .NET app without modification.

In jRDC, we use jdbc to connect to the database, not ADO.NET data provider such as Finisar.SQLite.
 
Last edited:
Upvote 0

TheFalcon

Active Member
Licensed User
Longtime User
Yeah, that was my problem, but apparently replacing the connection mode Finishar.sqlite with System.Data.SQLite

It works perfectly, which has saved my life, otherwise I don't know what I would have done :)
 
Upvote 0
Top