Android Example RDC - Simple way to create your own back-end database

Status
Not open for further replies.
Remote Database Connector (RDC) is a middleware web server that allows you to easily connect your Android app to any type of remote database server.
Usually you will use it with a database server (MySQL, DB2, etc...).

However you can also use RDC without a database server. Instead you can use a SQLite database file. In that case the database server is not needed.

This is done with sqlite-jdbc driver. This is an open source project that provides a JDBC driver for SQLite databases.

You can download the driver here (sqlite-jdbc-3.7.2.jar): https://bitbucket.org/xerial/sqlite-jdbc/downloads

Configuration:
  1. Copy the jar file to the jdbc_driver folder.
  2. Set the following lines in config.properties (change the path to your database file):
    B4X:
    DriverClass=org.sqlite.JDBC
    JdbcUrl=jdbc:sqlite:C:/temp/test.db
  3. SQLite doesn't support concurrent writings. So it is better to limit the connection pool to a single connection. This means that if there are multiple requests at parallel they will wait for the previous transaction to complete.
    To limit the connection pool you need to edit c3p0.properties and add:
    B4X:
    c3p0.minPoolSize=1
    c3p0.maxPoolSize=1

You can use a tool such as SQLite Expert to open the database and administrate it: http://www.sqliteexpert.com/download.html
 

peggjones

Active Member
Licensed User
Longtime User
I am trying to get RDC working - as usual from a point of almost complete ignorance!

Could someone tell me what the IP address in the following is?

reqManager.Initialize(Me, "http://192.168.0.7:17178")

What should I set it to?

Many thanks
 

peggjones

Active Member
Licensed User
Longtime User
I've done that and it still doesn't work. I'm not convinced I have everything in the right place. I downloaded RDC-Server and copied the driver etc.. But where should I have downloaded it to? I can't get my head round how the client program knows where everything is!
 

peggjones

Active Member
Licensed User
Longtime User
I'll try that thanks. Where should the RDC-Server folder that I downloaded be? That is what I am having trouble grasping. For example there might be more than one copy of it on the PC how would it know which one to use?

Many thanks for your understanding and help.
 

peggjones

Active Member
Licensed User
Longtime User
Got it working, many thanks again. I know you now prefer acknowledgements via a click on the like button. However I feel I must congratulate you not just on the excellent software but also on the fantastic level of support. I have worked on help desks myself and I know how difficult it can be sorting out problems remotely for people who aren't really sure of what they're doing. The overall package is excellent value for money.
 

peggjones

Active Member
Licensed User
Longtime User
Anyone got an idea as to why I can connect one tablet to my server but not another one? My nexus 10 will connect but my nexus 7 won't!

Thanks
 

peggjones

Active Member
Licensed User
Longtime User
Yes I got "testconnectiononcheckin -> false testconnectiononcheckout -> false unreturned connection timeout". It just seems odd that one device is accepted and the other isn't.
 

peggjones

Active Member
Licensed User
Longtime User
I've done that on both my devices, one says "Connection successful", the other says "oops Google Chrome could not connect to ...."
 

LucaMs

Expert
Licensed User
Longtime User
I ran every step, the server starts and on browser I get:
RemoteServer is running (Thu Jan 02 20:26:29 CET 2014)
Connection successful.

Only one problem: the file created, test.db, is not recognized as a SQLite 3.0.

(to stop the server? maybe "stopping" the batch?)

[EDIT]

I tried to use a db v. 3.0 and everything works.
But it seems that "JdbcUrl=jdbc:sqlite:C:/temp/test.db" creates an earlier version.
I also tried to use another driver: sqlite-jdbc-3.7.15-M1 (perhaps should I first uninstall something?)
 
Last edited:
Status
Not open for further replies.
Top