connection android studio to sql server - java

Please I have been trying to connect my android studio to my SQL server,but it's not working. It's giving me error of connection refused.
Probably not a portal: exception java.net.UnknownHostException: Unable to resolve host "connectivitycheck.gstatic.com": No address associated with hostname java.net.ConnectException: failed to connect to /10.20.37.39 (port 1433): connect failed: ECONNREFUSED (Connection refused)
I googled the error and from the results found out that the problem could have come from
firewall
not enabling tcp/ip
and using poor IP address.
I have tried to counter all of this but am still getting the error. I don't know what to do because am working on a school project. I have to submit soon. Again when I checked my SQL server log i saw a significant part of the SQL process has been page out.

Related

Do not close the application after an unsuccessful attempt to connect to the database java.net.ConnectException database: Connection refused

Spring Boot Data/Postgres.
Problem:
If the resource-database (postgres) is not available when the application starts, the application will fail with an error.
Caused by: org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
...
Caused by: java.net.ConnectException: Connection refused (Connection refused)
Question:
How can I get the application to automatically try to reconnect?
Assumptions:
Use Spring-Retry project to wrap #entityManagerFactory bean with retry attempts.
Have you tried handling the exception?
Try to handle this exception and upon the occurance, the appliaction can re-try connecting to the DB. Of course it would be beneficial to give the user the oportunity to decide if he wishes to re-try in order to avoid the infinite loop.
#KDecker, thank you for a valid point!

How to resolve java.net.ConnectException: Connection refused

i am running my android application in device its not connecting to device.Its giving following error
[2016-10-24 19:41:00 - DeviceMonitor] Failed to start monitoring 127.0.0.1:5558
[2016-10-24 19:41:17 - Device] Error during Sync: Connection refused: connect
[2016-10-24 19:41:38 - Device] Error during Sync: Connection refused: connect
Try giving user permission to your manifest
<uses-permission android:name="android.permission.INTERNET" />
If you are sure that the server IP address and port number correct then my answer will not be so helpful.
Otherwise: - Especially if you are using different JVMs for the client android app and the java program(your server). This could happen probably because they are both referencing different localhosts.
Open command line and issue the command ipconfig you will get details about your network configurations. Instead of localhost Use the physical address of your computer(IPv4 address displayed on your terminal), it looks something like below.

Android Socket Connection Refused ETIMEDOUT (Connection timed out)

I have created a server on my PC (localhost and port is 8080) and am trying to connect to it on my android device. But every time i try it gives me this error:
java.net.ConnectException: failed to connect to /10.0.2.2 (port 8080): connect failed: ETIMEDOUT (Connection timed out)
I have been looking online forever and looked at countless pages and have tried everything I could find.
-Switched the android host to 10.0.2.2
-Turned off firewall
-Changed the port
-Made sure both the PC and the android device where connected to the same internet connection
The Server code is written in Java and, just to make sure it works I tried making a connection to the server with another Java app. And it worked.
Thank you for your help, if you need any more info just let me know.
Do not use 10.0.2.2. That is for if your app runs on an emulator.
Use the LAN ip of your pc.
Find out with ipconfig.

How to solve ConnectException error when using Boilerpipe?

I want to use Boilerpipe to extract text from a newspage on several website, the problem is that every time I try it, I get a ConnectionException error.
I just used the example syntax from the boilerpipe quickstart guide :
URL url = new URL("http://www.telegraph.co.uk/news/health/11523739/Nine-in-10-GPs-say-no-to-seven-day-opening.html");
String text = ArticleExtractor.INSTANCE.getText(url);
And here is the connection error :
de.l3s.boilerpipe.BoilerpipeProcessingException: java.net.ConnectException: Connection refused: connect
at de.l3s.boilerpipe.extractors.ExtractorBase.getText(ExtractorBase.java:89)
at extract.Test.main(Test.java:14)
Caused by: java.net.ConnectException: Connection refused: connect
I tried with a lot of sites but it comes to the same error.
How can I solve this problem, or at least see where is the problem ? (maybe a firewall, or port configurations...)
After further researchs, I found out that it was a firewall in the enterprise which blocked those requests.

connecting to postgreSQL server failed

I am trying to install "Kwok information server" and I am new to postgreSQL. I just followed the installation guide of Kwok information server.
when I am trying to install kwok-schema-setup.jar file using java through postgreSQL server in Command Prompt, I am getting the following error..."Connecting to PostgreSQL Server ...failed. Connection refused. Check that the ho
stname and port are correct and that the postmaster is accepting TCP/IP connecti
ons. Cause: java.net.ConnectException: Connection refused: connect
Schema setup encountered errors" .
And when I am trying to connect to the server using pgAdmin III, I am getting the following error "Server doesn't listen
The server doesn't accept connections: the connection library reports
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "127.0.0.1" and accepting TCP/IP connections on port 5432? ".
Please anyone help me regarding, Thanks in advance!!
Looks like your Postgresql daemon is not running. Check if the server has started and is running. I dont know which OS you are using but try ps -ax on linux/mac or the task manager in windows.
Maybe a firewall that is blocking the connection, you have to provide more information about your environment to be sure.

Categories