B4J Question problem for JRDC2

T.T Wang

Member
Licensed User
Longtime User
I have run JRDC2.jar successfully on the server, but I use a tool to browse the test database, there is no table in it. pls. help me to understand it . Thank you!

using the sample code as below:
#DATABASE CONFIGURATION
DriverClass=com.mysql.jdbc.Driver
JdbcUrl=jdbc:mysql://localhost/test?characterEncoding=utf8
User=root
Password=Wang1415926
#Java server port
ServerPort=17178

#example of MS SQL Server configuration:
#DriverClass=net.sourceforge.jtds.jdbc.Driver
#JdbcUrl=jdbc:jtds:sqlserver://<server address>/<database>

#example of postegres configuration:
#JdbcUrl=jdbc:postgresql://localhost/test
#DriverClass=org.postgresql.Driver

#SQL COMMANDS
sql.create_table=CREATE TABLE IF NOT EXISTS animals (\
id INTEGER PRIMARY KEY AUTO_INCREMENT,\
name CHAR(30) NOT NULL,\
image BLOB)
sql.insert_animal=INSERT INTO animals VALUES (null, ?,?)
sql.select_animal=SELECT name, image, id FROM animals WHERE id = ?;
sql.create_table=CREATE TABLE article (col1 numeric(10,4) ,col2 text);
sql.select=select * from article
sql.insert=INSERT INTO article VALUES(?, ?)
 

T.T Wang

Member
Licensed User
Longtime User
hello Erel, tks for your quick advice. I regard the codes in the file "config.properties" below will work, and will generate a table named "animal" , is it wrong?

#SQL COMMANDS
sql.create_table=CREATE TABLE IF NOT EXISTS animals (\
id INTEGER PRIMARY KEY AUTO_INCREMENT,\
name CHAR(30) NOT NULL,\
image BLOB)
sql.insert_animal=INSERT INTO animals VALUES (null, ?,?)
sql.select_animal=SELECT name, image, id FROM animals WHERE id = ?;
sql.create_table=CREATE TABLE article (col1 numeric(10,4) ,col2 text);
sql.select=select * from article
sql.insert=INSERT INTO article VALUES(?, ?)
 
Upvote 0

josejad

Expert
Licensed User
Longtime User
I regard the codes in the file "config.properties" below will work, and will generate a table named "animal" , is it wrong?
You're right. But this code doesn't execute automatically, it must be called from at least one client to execute it, as Erel said, or you have to create the table manually in your database
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

T.T Wang

Member
Licensed User
Longtime User
May look at this: https://www.b4x.com/android/forum/threads/jrdc2-client-example-using-modded-jrdc2.85581/. It is an client example, but you’ll have to configure you’re jRDC2 server for the database tables used. Info should be in the source of the client. Disclaimer: I’m the author of that example.
Thank you! OliverA. I tried many times, it seems no effect. No sheet is built.
I've changed the client url responding with the server. such as attached file.
Could help me to run your example correctly?
 

Attachments

  • 2.png
    2.png
    39.9 KB · Views: 253
  • 4.png
    4.png
    15.9 KB · Views: 223
Upvote 0

T.T Wang

Member
Licensed User
Longtime User

Attachments

  • 3.png
    3.png
    35 KB · Views: 447
Upvote 0

T.T Wang

Member
Licensed User
Longtime User
May look at this: https://www.b4x.com/android/forum/threads/jrdc2-client-example-using-modded-jrdc2.85581/. It is an client example, but you’ll have to configure you’re jRDC2 server for the database tables used. Info should be in the source of the client. Disclaimer: I’m the author of that example.

on the side of java server, it shows some warnings blow, because of chinese word? but no sheet is built
Command: , took: 9962ms, client=103.27.26.218
七月 27, 2019 6:51:18 下午 com.mchange.v2.resourcepool.BasicResourcePool
警告: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@c066767
-- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acq
uire a needed new resource, we failed to succeed more than the maximum number of
allowed acquisition attempts (30). Last acquisition attempt exception:
java.sql.SQLException: The server time zone value '?й???????' is unrecognized o
r represents more than one time zone. You must configure either the server or JD
BC driver (via the serverTimezone configuration property) to use a more specifc
time zone value if you want to utilize time zone support.
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
jRDC2 server is not properly connecting to your MySQL server due to time zone issue (at least that is what the log shows). That issue needs to be solved first. Hopefully someone else can chime in (I’m currently working on some home improvement projects)
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
Upvote 0

T.T Wang

Member
Licensed User
Longtime User

I checked timezone, it is same.
I'm a newer. I'v read all about jRDC articles, but still can't run it.
Now, I want to step by step.
First, built a table in the test database. Still I failed. Could you write a simple sample just building a table?
 
Upvote 0

T.T Wang

Member
Licensed User
Longtime User


Hi, OliverA! thank you very much. It works!
even it shows same timezone, I also set again "set global time_zone = '+8:00';" using the mySQL command

I'll make a further study of your sample. thank you again.
 

Attachments

  • 2.png
    2.png
    29.9 KB · Views: 230
Upvote 0
Top