B4J Question jRDC server config params (need help)

Cableguy

Expert
Licensed User
Longtime User
I need help setting up my jRDC server...
The server is running on a vps, but it fails to connect to the database...

These are my current config params:

DriverClass=com.mysql.jdbc.Driver
JdbcUrl=jdbc:mysql://localhost/test:17178/test

my #AdditionalJar: mysql-connector-java-5.1.40-bin

but I always get "Error fetching connection."
 

ThRuST

Well-Known Member
Licensed User
Longtime User
Error fetching connection means that the driver is not compatible to make a connection, so worth changing the driver might help.
Conclusion: The database must have a correct driver for the database type or the error message appears.
Also check the server log. There's also jRDC2 maybe that is compatible with the current driver. Sorry but that's all I've got :)
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
https://www.b4x.com/android/forum/threads/b4j-web-server-rdc-vs-php.74081/#post-470413

The above link is my config which works fine.

Make sure you use the right Driverclass (MySQl in my case)

#MySQL Server
DriverClass=com.mysql.jdbc.Driver
JdbcUrl=jdbc:mysql://localhost/harris?characterEncoding=utf8 ' bold is the database you want to connect to

Note the port in the file... Review the post above for more info...

# MySQL DB username and password
User=harris
Password=xyZ1234
 
Upvote 0

EnriqueGonzalez

Expert
Licensed User
Longtime User
To connect to a LOCAL database the connection string should be:

jdbc:mysql://localhost:3306/test?

Server, Port, Database.
(if port is default 3306 it can be omited)

or something like this:

B4X:
SQL1.Initialize2("org.mariadb.jdbc.Driver","jdbc:mariadb://localhost/nexo_clinico","admin0","admin")
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
I still can't get my jRDC server to connect to my database.

I decided to create a new blank database, called "xpto"

So as now my config file is:

#DATABASE CONFIGURATION
DriverClass=com.mysql.jdbc.Driver
JdbcUrl=jdbc:mysql://localhost/xpto
User=psapg
Password=xxxxxxx
#Java server port
ServerPort=17178


In myPHPAdmin I have found the following info:

Database server version5.1.73

so my #include should be compatible since it's

#AdditionalJar: mysql-connector-java-5.1.40-bin

The JRDC server is running and does try to connect...

If I try

http://www.pg-engineering.net:3306/xpto

I get as response

4 5.1.73d¾pW@x\G,Eÿ÷Xh%zZ3/3S&cBÿ„Got packets out of order


I am willing to give server temp access to someone in order to point me the way and possible set me an empty (no sql commands) jRDC server that I can work with...
PLEASE!!!
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Just to add a few more info on my server side...

-sh-4.1$ java -version
java version "1.8.0_112"
Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)
 
Upvote 0

EnriqueGonzalez

Expert
Licensed User
Longtime User
ey Cable Guy,

I am a bit busy today, but at night i may do some tests. PM if you want.

i Think only SSH is needed for testing pourposes.
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
@Enrique Gonzalez R
I surely need help... I just cannot connect to the database and can't figure out out of all the error messages...
Now not even heidi will connect due to the huge amount of failed attempts...

This is a server side error when trying to access using jRDC and the localhost:17178/test
Dec 29, 2016 4:51:21 PM com.mchange.v2.resourcepool.BasicResourcePool forceKillAcquires
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@6f771389 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
Dec 29, 2016 4:51:21 PM com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask run
WARNING: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@3c9382be -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire 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: Access denied for user 'psapg'@'localhost' (using password: YES)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:964)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:873)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:4417)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1278)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2284)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2083)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:806)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:47)
at sun.reflect.GeneratedConstructorAccessor3.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:410)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:328)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:146)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:195)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:184)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:200)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1086)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquireAndDecrementPendingAcquiresWithinLockOnSuccess(BasicResourcePool.java:1073)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:44)
at com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:648)

Dec 29, 2016 4:51:21 PM com.mchange.v2.resourcepool.BasicResourcePool forceKillAcquires
WARNING: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@6f771389 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.

this shows a user denied error... but the user exists and it has full access using the online myPHPAdmin
 
Upvote 0

Harris

Expert
Licensed User
Longtime User
http://www.pg-engineering.net:17178/test

When I execute above in my browser, I get the following:

RemoteServer is running (12/29/2016 19:37:25)
Connection successful.

Try adding "?characterEncoding=utf8" after your database name... as below...

JdbcUrl=jdbc:mysql://localhost/harris?characterEncoding=utf8


When I run http://www.pg-engineering.net:17178/xpto - I get...

HTTP ERROR: 404
Problem accessing /xpto. Reason:

Not Found
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
http://www.pg-engineering.net:17178/test

When I execute above in my browser, I get the following:

RemoteServer is running (12/29/2016 19:37:25)
Connection successful.

Try adding "?characterEncoding=utf8" after your database name... as below...

JdbcUrl=jdbc:mysql://localhost/harris?characterEncoding=utf8


When I run http://www.pg-engineering.net:17178/xpto - I get...

HTTP ERROR: 404
Problem accessing /xpto. Reason:

Not Found
Yes, @Enrique Gonzalez R has been working some magic on my server and apparently he has managed to get it working...
I think the jRDC maybe down now as I get connection refused
 
Upvote 0
Top