B4J Question B4J - servermysql usbwebserver and connections

micro

Well-Known Member
Licensed User
Longtime User
Hi guys
some time ago I happened to see a post where any of you have used as mysql server, usbwebserver, which for my opinion is quite light and with discreetly performance.
I have a problem with a connection, I have PCs connected to the internal network so no routing on the Internet.
I installed on a PC a webserver (usbwebserver) that run at startup and a b4j program that works with a DB, precisely a DB on usbwebserver.
So far in localhost is okay with this connection string:
jdbc:mysql://localhost:3307/GestDB (txtconndbinto)

On another pc with same program but with different connection string, times out and does not connect.
I tried both to enter the ip or PC Name but with same result
jdbc:mysql://192.168.2.23:3307/GestDB o jdbc:mysql://USER-PC:3307/GestDB

B4X:
pool.Initialize("com.mysql.jdbc.Driver", mapset.Get("txtconndbinto"), mapset.Get("txtuserconndbinto"), mapset.Get("txtpassconndbinto")) '< qui ok
Dim sql As SQL = pool.GetConnection '< qui va in timeout ed esce

I opened the 3307 port on the router but the problem are the same.
I missing something?
Thanks
 
Last edited:

Harris

Expert
Licensed User
Longtime User
Try to connect to the db with phpmyadmin from the connected PC.
 
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
Not built for https???
No work only in http mode but it's not problem for me.

...perhaps between settings there is the possibility to set security mode 'https'

Log:
B4X:
Waiting for debugger to connect...
Program started.
ott 13, 2016 9:01:24 PM com.mchange.v2.log.MLog <clinit>
INFORMAZIONI: MLog clients using java 1.4+ standard logging.
ott 13, 2016 9:01:24 PM com.mchange.v2.c3p0.C3P0Registry banner
INFORMAZIONI: Initializing c3p0-0.9.2.1 [built 20-March-2013 11:16:28 +0000; debug? true; trace: 10]
ott 13, 2016 9:01:24 PM com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
INFORMAZIONI: 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 -> 1hge1bm9j1h41mrw1vs7vnm|166b4fe, debugUnreturnedConnectionStackTraces -> false, descr...
ott 13, 2016 9:01:55 PM com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask run
AVVERTENZA: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@e517aa -- 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: null,  message from server: "Host 'User-PC' is not allowed to connect to this MySQL server"
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1038)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2254)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2285)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2084)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
    at sun.reflect.GeneratedConstructorAccessor11.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327)
    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)
ott 13, 2016 9:01:55 PM com.mchange.v2.resourcepool.BasicResourcePool forceKillAcquires
AVVERTENZA: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@627aa6 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
ott 13, 2016 9:01:55 PM com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask run
AVVERTENZA: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@cfb8c0 -- 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: null,  message from server: "Host 'User-PC' is not allowed to connect to this MySQL server"
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1038)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2254)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2285)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2084)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
    at sun.reflect.GeneratedConstructorAccessor11.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327)
    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)
ott 13, 2016 9:01:55 PM com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask run
AVVERTENZA: com.mchange.v2.resourcepool.BasicResourcePool$ScatteredAcquireTask@1a61dbd -- 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: null,  message from server: "Host 'User-PC' is not allowed to connect to this MySQL server"
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:959)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:898)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:887)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1038)
    at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2254)
    at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2285)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2084)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
    at sun.reflect.GeneratedConstructorAccessor11.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:400)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:327)
    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)
ott 13, 2016 9:01:55 PM com.mchange.v2.resourcepool.BasicResourcePool forceKillAcquires
AVVERTENZA: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@627aa6 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
ott 13, 2016 9:01:55 PM com.mchange.v2.resourcepool.BasicResourcePool forceKillAcquires
AVVERTENZA: Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@627aa6 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
 
Upvote 0

billzhan

Active Member
Licensed User
Longtime User
Last edited:
Upvote 0

micro

Well-Known Member
Licensed User
Longtime User
SOLVED!!!

Thanks to all, problem solved.
setup the privileges directly from phpmyadmin deciding what operations (privileges) is allowed to do on the data on the structure and at the level of administration and
the host name (ip).
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…