B4J Question problem for JRDC2

Discussion in 'B4J Questions' started by T.T Wang, Jul 23, 2019.

  1. T.T Wang

    T.T Wang Member Licensed 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(?, ?)
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Have you called create_table from one of the clients? It will not be called automatically.
     
  3. T.T Wang

    T.T Wang Member Licensed 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(?, ?)
     
  4. José J. Aguilar

    José J. Aguilar Well-Known Member Licensed User

    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
     
    emexes likes this.
  5. T.T Wang

    T.T Wang Member Licensed User

    thank you!Jose
    I'll have a try
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    Moved to the questions forum.
     
  7. T.T Wang

    T.T Wang Member Licensed User

    Could you tell me how to execute it on the client end? Thks
     
  8. DonManfred

    DonManfred Expert Licensed User

  9. OliverA

    OliverA Expert Licensed User

  10. T.T Wang

    T.T Wang Member Licensed User

    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?
     

    Attached Files:

    • 2.png
      2.png
      File size:
      39.9 KB
      Views:
      11
    • 4.png
      4.png
      File size:
      15.9 KB
      Views:
      10
  11. T.T Wang

    T.T Wang Member Licensed User

    attached file is the java server config. And the java server runs on the same IP server with the MySQL server.
     

    Attached Files:

    • 3.png
      3.png
      File size:
      35 KB
      Views:
      43
  12. T.T Wang

    T.T Wang Member Licensed User

    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.
     
  13. OliverA

    OliverA Expert Licensed 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)
     
  14. OliverA

    OliverA Expert Licensed User

  15. T.T Wang

    T.T Wang Member Licensed 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?
     
  16. T.T Wang

    T.T Wang Member Licensed User

    timezone
     

    Attached Files:

    • 1.png
      1.png
      File size:
      454.2 KB
      Views:
      11
  17. T.T Wang

    T.T Wang Member Licensed 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.
     

    Attached Files:

    • 2.png
      2.png
      File size:
      29.9 KB
      Views:
      13
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice