Android Question Can a B4a app open a SQLite db on a PC

baron

Member
Licensed User
Longtime User
I can update a SQLite db in File.DirRootExternal, but I want to do the same directly to a SQLite db on my pc.

Using a wireless connection, with full read/write permissions on the folder and the SQLite db, the following code works perfectly, and finds the db in the Shared folder on my pc.

Dim SMB1 As SMB
SMB1.Initialize("SMB1")
SMB1.SetCredentials("MyLogin","MyPassword","")
SMB1.ListFiles("smb://MyPC/Shared/", "")

However, the following attempt to open the db on the pc fails with the message:

"android.database.sqlite.SQLiteCantOpenDatabaseException: unknown error (code 14): Could not open database"

Dim SQL1 As SQL
Dim SMB1 As SMB
SMB1.Initialize("SMB1")
SMB1.SetCredentials("MyLogin","MyPassword","")
SQL1.initialize("smb://HP/Shared/","MySQlite.db", False)

Should this work, and then allow me to insert records ?
 

baron

Member
Licensed User
Longtime User
This will not work. You can use a solution such as described here (RDC with SQLite):
RDC - Simple way to create your own back-end database

I've followed the instructions and this is the cmd box after starting the service:

upload_2013-8-23_11-55-40.png


Config.Properties

DriverClass=org.sqlite.jdbc
JdbcUrl=jdbc:sqlite:c:/Shared/M3Mobile.db

User=mylogin
Password=mypassword
ServerPort=17178
Debug=true


I downloaded sqlite-jdbc-3.7.2.jar and copied it into RemoteDatabaseConnector/jdbc_driver

When I test it in a browser (http://127.0.0.1:17178/?method=test), the following messages appear:

upload_2013-8-23_12-1-25.png


This is all on a Windows 7 64 bit system. I can't see any clues to why the driver is not found. Help anyone ?
 
Upvote 0
Top