Connect MYSQL to Android studio - android

anybody knows how to connect MYSQL to android studio using MYSQL workbench. I have tried all methods, it shows following error.
com.mysql.jdbc.CommunicationsException: Communications link failure due to
underlying exception:
01-17 16:21:56.845 30367-30442/animaltracking.kevell.com.myapplication
W/System.err: ** BEGIN NESTED EXCEPTION **
01-17 16:21:56.845 30367-30442/animaltracking.kevell.com.myapplication
W/System.err: java.net.SocketException
01-17 16:21:56.845 30367-30442/animaltracking.kevell.com.myapplication
W/System.err: MESSAGE: java.net.ConnectException: Connection refused

You can use the following link to connect third-party database By using rest web services or web services:-
Link:-https://www.youtube.com/watch?v=Ucs-blvF3d8&t=1096s
NOTE:- Use Volley or Volley plus, Retrofit, HttpOk

You should not do this. Instead you should use REST APIs to communicate with database.
https://android.jlelse.eu/consuming-rest-api-using-retrofit-library-in-android-ed47aef01ecb

Related

Firebase realtime database no longer loading in my console. Writes also failed inside my Android app

Firebase realtime database is no longer loading in my console. It only show an empty content without any error. Rules for the database fail to load as well.
Inside my Android app writes to the realtime database fail with :
E/SOL: failed to put
'https://[appid].firebaseio.com/logs/2022/3/12/0/us_0600830214/s110.json',
ex: Failed to connect to
[appid].firebaseio.com/2600:1901:0:94b6:::443
java.net.ConnectException: Failed to connect to
[appid].firebaseio.com/2600:1901:0:94b6:::443
atokhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:297)
atokhttp3.internal.connection.RealConnection.connect(RealConnection.kt:207)
atokhttp3.internal.connection.ExchangeFinder.findConnection(ExchangeFinder.kt:226)
atokhttp3.internal.connection.ExchangeFinder.findHealthyConnection(ExchangeFinder.kt:106)
atokhttp3.internal.connection.ExchangeFinder.find(ExchangeFinder.kt:74)
atokhttp3.internal.connection.RealCall.initExchange$okhttp(RealCall.kt:255)
atokhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.kt:32)
atokhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
atokhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.kt:95)
atokhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
atokhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.kt:83)
atokhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
atokhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.kt:76)
atokhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.kt:109)
atokhttp3.internal.connection.RealCall.getResponseWithInterceptorChain$okhttp(RealCall.kt:201)
atokhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:517)
atjava.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
atjava.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Suppressed: java.net.SocketTimeoutException: failed to connect
to [appid].firebaseio.com/35.201.97.85 (port 443) from
/10.0.2.16 (port 33500) after 10000ms
at libcore.io.IoBridge.connectErrno(IoBridge.java:191)
at libcore.io.IoBridge.connect(IoBridge.java:135)
at java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:142)
atjava.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:390)
atjava.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:230)
atjava.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:212)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:436)
at java.net.Socket.connect(Socket.java:621)
atokhttp3.internal.platform.Platform.connectSocket(Platform.kt:120)
atokhttp3.internal.connection.RealConnection.connectSocket(RealConnection.kt:295)
I changed nothing in my code or console. A couple of days ago the console stop loading and the write errors I think stop working way before I just didn't pay much attention to it.
I don't see any project quotas being surpassed, all values are very close to 0% of usage for the free spark plan.
I also checked the google-services.json, minor changes, ... and updating to the new version did not fix the write failures.
Has anyone else experienced this?
I have contacted Firebase support and they have confirmed that such behavior have been reported by several other users but from what they can tell it is all fine on their side. The issue lies with the ISP from my country. All other reports had the same origin.

ParseRequestException: i/o failure occuring with app in background

I see this crash in firebase's crashlytics, with 99% of cases while app is in background:
Non-fatal Exception: com.parse.ParseRequest$ParseRequestException: i/o failure
at com.parse.ParseRequest.newTemporaryException(ParseRequest.java:288)
at com.parse.ParseRequest$2.then(ParseRequest.java:142)
Caused by java.net.UnknownHostException: Unable to resolve host "ourparseserver.cloud": No address associated with hostname
at java.net.Inet6AddressImpl.lookupHostByName(Inet6AddressImpl.java:156)
at
Caused by android.system.GaiException: android_getaddrinfo failed: EAI_NODATA (No address associated with hostname)
The app uses a subclass of AbstractThreadedSyncAdapter to handle syncing between Parse server and local database.
Does anyone know how to fix this issue ?
Could it be related to AbstractThreadedSyncAdapter trying to do some syncing when app is in background ?
Note: I already checked similar questions and answers, such as missing permissions, checking internet access... but none of them help. This issue is different because it involves Parse server and AbstractThreadedSyncAdapter.

com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException:Read error:ssl=0xb4000071bca8e448: Failure in SSL library,usually a protocol

I'm using volley in my app and send request to my server but i got this error from my onErrorResponse volley:
Error: com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: Read error: ssl=0xb4000071bca8e448: Failure in SSL library, usually a protocol error
error:10000438:SSL routines:OPENSSL_internal:TLSV1_ALERT_INTERNAL_ERROR (external/boringssl/src/ssl/tls_record.cc:587 0xb4000071bca09588:0x00000001)
I'm using device with android 11 and the request does not work what should i do?
Make sure you have connected to wifi

Handshake failed with Volley or Retrofit Android

I'm making an app for Android 4.4 and above, and I'm trying to do an https request, I first tried with Retrofit and it gives me this:
V/error: javax.net.ssl.SSLHandshakeException: Handshake failed
I thoug it was something about the Retrofit API, but later I tried with Volley and it gives me this:
SSL handshake aborted: ssl=0xf311e9c8: Failure in SSL library, usually a protocol error
error:10000410:SSL routines:OPENSSL_internal:SSLV3_ALERT_HANDSHAKE_FAILURE (third_party/openssl/boringssl/src/ssl/tls_record.cc:562 0xd4fba9c8:0x00000001)
error:1000009a:SSL routines:OPENSSL_internal:HANDSHAKE_FAILURE_ON_CLIENT_HELLO (third_party/openssl/boringssl/src/ssl/handshake.cc:464 0xd7936bd8:0x00000000)
12-29 16:37:53.551 13763-14823/xxx.xxx.xx I/qtaguid: Untagging socket 47
12-29 16:37:53.571 13763-13763/xxx.xx.xx V/error: javax.net.ssl.SSLHandshakeException: Handshake failed
In fact, is the same issue, I don't know if I need add something to my app, due this request works perfectly with postman.
The weird thing is, before we migrate the services to the new server, I was working with a server with HTTP and it works perfectly. I don't know what I must add about security to my app.

OpeningHandshakeException for Meteor Backend for Android app

I've just learnt and implemented my first Meteor app with simple meteor create hellometeor command, then have used ngrok to make localhost:3000 port live.
Then I have used delight-im/Android-DDP library to connect to the direct ws url as per the following code:
// create a new instance, where mMeteor is a global var.
mMeteor = new Meteor(this, "ws://180a3c0e.ngrok.io", new InMemoryDatabase()); // "ws://180a3c0e.ngrok.io" is the temp. url after tunneling `localhost:3000`
// register the callback that will handle events and receive messages
mMeteor.addCallback(this); // as the activity implements MeteorCallback
// establish the connection
mMeteor.connect();
But every-time I try to run this code, I'm getting the following error, for which I've found no suggestion or straight-forward solution, for a newbie like me in Meteor like platforms during the past 6hrs of googling and reading:
W/System.err: java.lang.Exception: com.neovisionaries.ws.client.OpeningHandshakeException: The status code of the opening handshake response is not '101 Switching Protocols'. The status line is: HTTP/1.0 502 Bad Gateway
W/System.err: at im.delight.android.ddp.Meteor$1.onError(Meteor.java:195)
W/System.err: at com.neovisionaries.ws.client.ListenerManager.callOnError(ListenerManager.java:432)
W/System.err: at com.neovisionaries.ws.client.ConnectThread.handleError(ConnectThread.java:50)
W/System.err: at com.neovisionaries.ws.client.ConnectThread.run(ConnectThread.java:41)
W/System.err: Caused by: com.neovisionaries.ws.client.OpeningHandshakeException: The status code of the opening handshake response is not '101 Switching Protocols'. The status line is: HTTP/1.0 502 Bad Gateway
W/System.err: at com.neovisionaries.ws.client.HandshakeReader.validateStatusLine(HandshakeReader.java:232)
W/System.err: at com.neovisionaries.ws.client.HandshakeReader.readHandshake(HandshakeReader.java:54)
W/System.err: at com.neovisionaries.ws.client.WebSocket.readHandshake(WebSocket.java:3113)
W/System.err: at com.neovisionaries.ws.client.WebSocket.shakeHands(WebSocket.java:2992)
W/System.err: at com.neovisionaries.ws.client.WebSocket.connect(WebSocket.java:2034)
W/System.err: at com.neovisionaries.ws.client.ConnectThread.run(ConnectThread.java:37)
May be I'm missing a very common thing in the Meteor server-side, as I haven't code a single line in it, other than initiating the project.Please enlighten me in this regard.
TIA.
I should be crucified for not knowing that Meteor has its websocket connection at ws://.../websocket url.
I have just added /websocket at the end of the previous URL and everything is working just as smooth.

Categories

Resources