B4J Question Raspberry Pi Mysql access B4J UI, jRDC2

atiaust

Active Member
Licensed User
Longtime User
Hi All,

I have been trying to get the B4J Tutorial https://www.b4x.com/android/forum/t...ssed-by-b4j-ui-application-using-jrdc2.67328/ working for a few days now without success.

Being new to RPi I find there is a few parts of the Tutorial that assumes an understanding of how to actually run the server components on the RPi.

I have successfully created the Mysql database as per the Tutorial and downloaded the java and jrdc components but would really appreciate some assistance in getting these running on the RPi. Step by step instructions like the how to create the database section.

Any help gratefully appreciated.

Thanks
 

atiaust

Active Member
Licensed User
Longtime User
Hi Erel,
No. Just trying to access the Mysql database on the RPi from B4j or B4a apps.
Thanks
 
Upvote 0

atiaust

Active Member
Licensed User
Longtime User
I have tried to run jRDC2 on the RPi. But I am not sure I have achieved it.

Can you provide run and test instructions.

Thanks
 
Upvote 0

atiaust

Active Member
Licensed User
Longtime User
Hi Rob,

I have been following your Tutorial.
All goes well until I try to run jRDC2.
I am not sure if my command line instructions to run jRDC2 is correct.

Your instructions to create the database are great but then it is assumed you know how to get everything working on the RPi.

Thanks

Geoff (atiaust)
 
Upvote 0

atiaust

Active Member
Licensed User
Longtime User
Thanks Erel,

Please excuse my slow reply, dinner time here in Australia.

I will start my system up and see what I can find.

Geoff
 
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi Rob,

I have been following your Tutorial.
All goes well until I try to run jRDC2.
I am not sure if my command line instructions to run jRDC2 is correct.

Your instructions to create the database are great but then it is assumed you know how to get everything working on the RPi.

Thanks

Geoff (atiaust)

In the example code, there is a folder RDC2 with the project jRDC:
  • Have you opened and started this project first (using the B4J Bridge; ensure the config.properties file is coped to the tempjars folder on the Raspberry Pi)?
  • Instead of opening the project and using the B4J bridge, copy the jRDC.jar and the config.properties file to a folder on the Raspberry Pi, like /home/pi/rdc and then start jRDC by invoking sudo java -jar jRDC.jar
When jRDC is started, connect using one of the clients (UI or Non-UI).
 
Last edited:
Upvote 0

atiaust

Active Member
Licensed User
Longtime User
Hi Rob,

It looks like I had the wrong jRDC.jar and config.properties files.
The server is now running as ver 2.11

When I run the UI and try to access the data base i get errors and timeouts.
The server shows that a client has sent a request.

as Erel suggested http://192.168.20.16:17178/?method=test I get error 404 Problem Accessing /Reason not found

Any other ideas gratefully accepted.

Thanks
 
Upvote 0

atiaust

Active Member
Licensed User
Longtime User
Erel, Rob,

When I try to access the database this is the response.

See attached image.
 

Attachments

  • Capture.jpg
    Capture.jpg
    54.4 KB · Views: 215
Upvote 0

rwblinn

Well-Known Member
Licensed User
Longtime User
Hmm, do not know what the cause could be to be honest :(

Just tested my example again:
* in config.properties ensure to set the ip of the raspberry pi, like JdbcUrl=jdbc:mysql://192.168.0.19/notes?characterEncoding=utf8
* In B4J IDE opened the jRDC project, connected to the B4J bridge running on the Raspberry Pi and run RDC - the B4J IDE log shows jRDC running v2.11
* In B4J IDE opened the B4J UI client, checked in the code the serverurl and serverport and started, then pressed select ... wait ... 3 records are shown

When running the select statement, the jRDC shows below in the log. Are there any entries when selecting?
B4X:
jRDC is running (version = 2.11)
Jul 14, 2016 11:00:21 AM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFO: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 20000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1m9h1sjpzgj1md8qzp|104e3b2, debugUnreturnedConnectionStackTraces -> false, description -> nul...
50, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> true, unreturnedConnectionTimeout -> 0, userOverrides -> {}, usesTraditionalReflectiveProxies -> false ]
Command: query: select3, took: 1291ms, client=192.168.0.4
Command: query: select3, took: 43ms, client=192.168.0.4

Are there any messages in the mysql logfile on the Raspberry Pi: Check with $cat /var/log/mysql/error.log
//The logfile location might be different depeding mysq
 
Upvote 0

atiaust

Active Member
Licensed User
Longtime User
Hi Erel,

Here is the log details when jRDC is started.

pi@raspberrypi:~ $ cd rdc
pi@raspberrypi:~/rdc $ sudo java -jar jRDC.jar
2016-07-15 13:11:12.482:INFO::main: Logging initialized @518ms
Jul 15, 2016 1:11:12 PM com.mchange.v2.log.MLog <clinit>
INFO: MLog clients using java 1.4+ standard logging.
Jul 15, 2016 1:11:13 PM com.mchange.v2.c3p0.C3P0Registry banner
INFO: Initializing c3p0-0.9.2.1 [built 20-March-2013 11:16:28 +0000; debug? true; trace: 10]
2016-07-15 13:11:13.526:INFO:eek:ejs.Server:main: jetty-9.3.z-SNAPSHOT
2016-07-15 13:11:13.710:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@1c7cbad{/,file:///home/pi/rdc/www,AVAILABLE}
2016-07-15 13:11:13.718:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened /home/pi/rdc/logs/b4j-2016_07_15.request.log
2016-07-15 13:11:13.762:INFO:eek:ejs.ServerConnector:main: Started ServerConnector@be92ad{HTTP/1.1,[http/1.1]}{0.0.0.0:17178}
2016-07-15 13:11:13.764:INFO:eek:ejs.Server:main: Started @1812ms
jRDC is running (version = 2.11)

Not sure if this helps.

Thanks
 
Upvote 0

atiaust

Active Member
Licensed User
Longtime User
Hi Erel,

How do I run jRDC2 on the PC?

I have tried the HelloWorld web app in debug mode on B4J running the B4j-bridge on the RPi.

B4J-Bridge V1.0
Waiting for connections (port=6790)....
My IPaddress is: 192.168.20.16
Connected!

When I run the Web App it advises

Waiting for debugger to connect...
Program started.
2016-07-15 14:57:29.929:INFO::main: Logging initialized @1166ms
2016-07-15 14:57:30.321:INFO:eek:ejs.Server:main: jetty-9.3.z-SNAPSHOT
2016-07-15 14:57:30.559:INFO:eek:ejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@6de728{/,file:///home/pi/Downloads/tempjars/www,AVAILABLE}
2016-07-15 14:57:30.568:INFO:eek:ejs.AbstractNCSARequestLog:main: Opened /home/pi/Downloads/tempjars/logs/b4j-2016_07_15.request.log
2016-07-15 14:57:30.605:INFO:eek:ejs.ServerConnector:main: Started ServerConnector@864e92{HTTP/1.1,[http/1.1]}{0.0.0.0:8888}
2016-07-15 14:57:30.608:INFO:eek:ejs.Server:main: Started @1856ms
Emulated network latency: 100ms
Server started

When I type http://192.168.20.16:8888

All I get is error 404 not found. Have tried this on 3 different PC's on the network with firewalls disabled.

Thanks
 
Upvote 0
Top