Hello.
i would like connect my app to a remote mysql server (mariaDB) for only save data in a log table.
i have find some code in forum, but i continue to have connection problems:
i have use this code:
this are my settings:
inside #Region Project Attributes i have this
error LOG:
anybody have just use it?
thanks you
i would like connect my app to a remote mysql server (mariaDB) for only save data in a log table.
i have find some code in forum, but i continue to have connection problems:
i have use this code:
B4X:
https://www.b4x.com/android/forum/threads/jdbcsql-directly-connect-to-remote-databases.84016/#content
this are my settings:
B4X:
Private driver As String = "com.mysql.jdbc.Driver"
Private jdbcUrl As String = "jdbc:mysql://localhost:3306/Example?characterEncoding=utf8"
Private Username As String = "root"
Private Password As String = "root"
inside #Region Project Attributes i have this
B4X:
#AdditionalJar: mysql-connector-java-5.1.38-bin.jar
#BridgeLogger: true
error LOG:
B4X:
JNI_OnLoad
mValues not put! needsGenerationTracker: true currentGeneration: -1 name: enable_navbar value: null
playSoundEffect effectType: 0
Class anywheresoftware.b4a.B4AThreadPool failed lock verification and will run slower.
Class com.mysql.jdbc.ConnectionImpl failed lock verification and will run slower.
Class com.mysql.jdbc.JDBC4Connection failed lock verification and will run slower.
Class com.mysql.jdbc.TimeUtil failed lock verification and will run slower.
Class com.mysql.jdbc.DatabaseMetaData failed lock verification and will run slower.
Class com.mysql.jdbc.MysqlIO failed lock verification and will run slower.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:981)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:339)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2286)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2085)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
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 java.sql.DriverManager.getConnection(DriverManager.java:569)
at java.sql.DriverManager.getConnection(DriverManager.java:219)
at anywheresoftware.b4j.objects.SQL.Initialize2(SQL.java:56)
at anywheresoftware.b4j.objects.SQL$1.call(SQL.java:98)
at anywheresoftware.b4j.objects.SQL$1.call(SQL.java:1)
at anywheresoftware.b4a.BA$3.run(BA.java:461)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:784)
Caused by: java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 33060) from /:: (port 54896): connect failed: ECONNREFUSED (Connection refused)
at libcore.io.IoBridge.connect(IoBridge.java:138)
at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:129)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:357)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:201)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:183)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:356)
at java.net.Socket.connect(Socket.java:616)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:298)
... 21 more
Caused by: android.system.ErrnoException: connect failed: ECONNREFUSED (Connection refused)
at libcore.io.Linux.connect(Native Method)
at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:126)
at libcore.io.IoBridge.connectErrno(IoBridge.java:152)
at libcore.io.IoBridge.connect(IoBridge.java:130)
... 29 more
Check unfiltered logs for JDBC errors.
Completed. Success: false
Log reader error: java.io.InterruptedIOException: read interrupted
-1 received
writer error
java.lang.InterruptedException
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.java:2034)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2068)
at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:387)
at anywheresoftware.b4a.remotelogger.Connector$Writer.run(Connector.java:160)
at java.lang.Thread.run(Thread.java:784)
** Activity (main) Pause, UserClosed = true **
** Service (starter) Destroy (ignored)**
System.exit called, status: 0
VM exiting with result code 0, cleanup skipped.
Reinit property: dalvik.vm.checkjni= false
ActivityThread,attachApplication
get used feature list :/feature/used-list failed!
USE_FEATURE_LIST had not init!
apicache mCurPackageName=eu.beraldogiuliano.worldcapital uptimes=368337699
apicache oUid null
apicache volumes null
apicache path=/storage/emulated/0 state=mounted key=eu.beraldogiuliano.worldcapital#10825#256
apicache path=/storage/9016-4EF8 state=mounted key=eu.beraldogiuliano.worldcapital#10825#256
apicache oUid 10825
apicache volumes null
apicache path=/storage/emulated/0 state=mounted key=eu.beraldogiuliano.worldcapital#10825#0
apicache path=/storage/9016-4EF8 state=mounted key=eu.beraldogiuliano.worldcapital#10825#0
apicache async read begin packageName=eu.beraldogiuliano.worldcapital userid=0
apicache pi null
uid=10825(u0_a825) queued-work-loo identical 1 line
apicache pi null
apicache oUid null
apicache async read finished packageName=eu.beraldogiuliano.worldcapital userid=0 totalus=3295
apicache pi null
Class androidx.multidex.MultiDex failed lock verification and will run slower.
Common causes for lock verification issues are non-optimized dex code
and incorrect proguard optimizations.
VM with version 2.1.0 has multidex support
Installing application
VM has multidex support, MultiDex support library is disabled.
MemoryLeakMonitor.jar is not exist!
Could not get cmap table size!
Constructor found for class android.app.HwCustActivityImpl
Create obj success use class android.app.HwCustActivityImpl
: success to get AllImpl object and return....
Constructor found for class android.app.HwCustHwWallpaperManagerImpl
Create obj success use class android.app.HwCustHwWallpaperManagerImpl
: successes to get AllImpl object and return....
ActivityThread,callActivityOnCreate
Class anywheresoftware.b4a.BA failed lock verification and will run slower.
common created.
Starting remote logger. Port: 62864
check blur style for HwPhoneWindow, themeResId : 0x7f04000f, context : eu.beraldogiuliano.worldcapital.main@522b276, Nhwext : 0, get Blur : disable with , null
add activity client record, r= ActivityRecord{aeccb50 token=android.os.BinderProxy@26ec59b {eu.beraldogiuliano.worldcapital/eu.beraldogiuliano.worldcapital.main}} token= android.os.BinderProxy@26ec59b
check blur style for HwPhoneWindow, themeResId : 0x7f04000f, context : eu.beraldogiuliano.worldcapital.main@522b276, Nhwext : 0, get Blur : disable with , null
After accept
mSecurityInputMethodService is null
HWUI Binary is enabled
HWUI GL Pipeline
onAttached begin
onAttached end
HiTouch restricted: AboardArea.
*** Debugger waiting for connection (0) ***
mIsEffect:false
Initialized EGL, version 1.4
Swap behavior 2
check blur style for HwToast-Toast, themeResId : 0x0103013f, context : androidx.multidex.MultiDexApplication@2c84b8b, Nhwext : 6, get Blur : disable with , android.graphics.drawable.NinePatchDrawable@eceb468
EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
startInputReason = 1
HWUI Binary is enabled
startInputReason = 5
HWUI Binary is enabled
EGLdebug relayoutWindow Surface isSurface(name=null) (appName =eu.beraldogiuliano.worldcapital) ( mSurfaceControllerIsValid =false) (mNativeObject =0)/@0x472d7b,viewVisibility is0
EGLdebug relayoutWindow Surface isSurface(name=null) (appName =eu.beraldogiuliano.worldcapital) ( mSurfaceControllerIsValid =true) (mNativeObject =71d95eb000)/@0x472d7b,relayoutResult is7
EGLdebug Surface isSurface(name=null) (appName =eu.beraldogiuliano.worldcapital) ( mSurfaceControllerIsValid =true) (mNativeObject =71d95eb000)/@0x472d7b
EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, egl_color_buffer_format *, EGLBoolean) returns 0x3000
*** Debugger waiting for connection (1) ***
*** Service (starter) Create ***
Device locale: it
Found 36 strings.
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Do partial code cache collection, code=28KB, data=20KB
After code cache collection, code=27KB, data=20KB
Increasing code cache capacity to 128KB
Class androidx.core.content.ContextCompat failed lock verification and will run slower.
apicache oUid 10825
apicache volumes [Landroid.os.storage.StorageVolume;@7cfada
H3X4C17A27001641
apicache oUid 10825
apicache volumes [Landroid.os.storage.StorageVolume;@7cfada
apicache oUid 10825
apicache volumes [Landroid.os.storage.StorageVolume;@7cfada
apicache oUid 10825
apicache volumes [Landroid.os.storage.StorageVolume;@7cfada
apicache oUid 10825
apicache volumes [Landroid.os.storage.StorageVolume;@8416b0b
apicache oUid 10825
apicache volumes [Landroid.os.storage.StorageVolume;@7cfada
0
H3X4C17A27001641
UpdateRecord: UPDATE [users] SET [username]=? WHERE [deviceID] = ?
Do partial code cache collection, code=61KB, data=47KB
After code cache collection, code=61KB, data=47KB
Increasing code cache capacity to 256KB
apicache oUid 10825
apicache volumes [Landroid.os.storage.StorageVolume;@7cfada
[HSM] stayAwake false uid: 10825, pid: 10580
resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
cleanDrmObj: mDrmObj=null mDrmSessionId=null
[HSM] stayAwake false uid: 10825, pid: 10580
resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
cleanDrmObj: mDrmObj=null mDrmSessionId=null
setDataSource(86, 0, 576460752303423487)
Message: MEDIA_PREPARED(1), ext1=0, ext2=0x0
[notify] : [1204] callback app listenerNotNull=1, send=1
[notify] : [1216] callback application
mValues not put! needsGenerationTracker: true currentGeneration: -1 name: accessibility_captioning_locale value: null
[HSM] stayAwake true uid: 10825, pid: 10580
Pid:10580 MediaPlayer::start
Action:start, CurrentState:MEDIA_PLAYER_STARTED
23/12/19
** Activity (main) Resume **
[HSM] stayAwake false uid: 10825, pid: 10580
Message: Unknown MediaEventType(8), ext1=0, ext2=0x0
Action:reset_l, CurrentState:MEDIA_PLAYER_IDLE
resetDrmState: mDrmInfo=null mDrmProvisioningThread=null mPrepareDrmInProgress=false mActiveDrmScheme=false
cleanDrmObj: mDrmObj=null mDrmSessionId=null
setDataSource(88, 0, 576460752303423487)
Message: MEDIA_PREPARED(1), ext1=0, ext2=0x0
[notify] : [1204] callback app listenerNotNull=1, send=1
[notify] : [1216] callback application
[HSM] stayAwake true uid: 10825, pid: 10580
Pid:10580 MediaPlayer::start
Action:start, CurrentState:MEDIA_PLAYER_STARTED
EGLNativeWindowType 0x71d95eb010 disconnect failed
JNI_OnLoad
mValues not put! needsGenerationTracker: true currentGeneration: -1 name: enable_navbar value: null
playSoundEffect effectType: 0
Class anywheresoftware.b4a.B4AThreadPool failed lock verification and will run slower.
Class com.mysql.jdbc.ConnectionImpl failed lock verification and will run slower.
Class com.mysql.jdbc.JDBC4Connection failed lock verification and will run slower.
Class com.mysql.jdbc.TimeUtil failed lock verification and will run slower.
Class com.mysql.jdbc.DatabaseMetaData failed lock verification and will run slower.
Class com.mysql.jdbc.MysqlIO failed lock verification and will run slower.
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:981)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:339)
at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2253)
at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2286)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2085)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:795)
at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:334)
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 java.sql.DriverManager.getConnection(DriverManager.java:569)
at java.sql.DriverManager.getConnection(DriverManager.java:219)
at anywheresoftware.b4j.objects.SQL.Initialize2(SQL.java:56)
at anywheresoftware.b4j.objects.SQL$1.call(SQL.java:98)
at anywheresoftware.b4j.objects.SQL$1.call(SQL.java:1)
at anywheresoftware.b4a.BA$3.run(BA.java:461)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:784)
Caused by: java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 33060) from /:: (port 54898): connect failed: ECONNREFUSED (Connection refused)
at libcore.io.IoBridge.connect(IoBridge.java:138)
at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:129)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:357)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:201)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:183)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:356)
at java.net.Socket.connect(Socket.java:616)
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:211)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:298)
... 21 more
Caused by: android.system.ErrnoException: connect failed: ECONNREFUSED (Connection refused)
at libcore.io.Linux.connect(Native Method)
at libcore.io.BlockGuardOs.connect(BlockGuardOs.java:126)
at libcore.io.IoBridge.connectErrno(IoBridge.java:152)
at libcore.io.IoBridge.connect(IoBridge.java:130)
... 29 more
Check unfiltered logs for JDBC errors.
Completed. Success: false
anybody have just use it?
thanks you
Last edited: