DB2 jdbc connection error Connection refused. ERRORCODE=-4499, SQLSTATE=08001 - java

I have a new DB2 server (v10.5.0.3), and I can connect to the database locally just fine.
When trying to connect from a remote server using JDBC I am getting the "Connection refused. ERRORCODE=-4499, SQLSTATE=08001" error. Based on information found here https://www-304.ibm.com/support/docview.wss?uid=swg21403644 I have confirmed that
[db2inst1#db2 ~]$ db2set -all
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=YES
[g] DB2SYSTEM=db2.xxxx.com
[g] DB2INSTDEF=db2inst1
[g] DB2ADMINSERVER=xxxxxx
and
[db2inst1#db2 ~]$ db2 get database manager configuration | grep -i svce
TCP/IP Service name (SVCENAME) = 50001
SSL service name (SSL_SVCENAME) =
with these JDBC connection values
driver=com.ibm.db2.jcc.DB2Driver
url=jdbc:db2://db2.xxxxx.com:50001/TESTGEN
username=XXXXXXXX
password=XXXXXXX
I have verified that the firewall on the both servers have opened ports 50000 and 50001. I've run out of ideas, any help is greatly appreciated.

I had the same trouble... Its was caused by IPV6...
The URL connection point to localhost, resolved as ::1 (the IPV6 address of localhost) and DB2 server doens't listing IPV6 protocol.
I resolved by modify the c:\windows\system32\driver\etc\host file : I uncomment the line 127.0.0.1 locahost to force ipv4 resolution name of locahost... and it's works.
I hope that helps. (sorry for my English)

I had same problem, when I couldn't connect to my remote database with Data Studio Client and with DB2 CLP console. Make sure that you checked ping to your server and it is successful, you checked dbm cfg and you know svcename, tcpip port number, you checked ..System32\drivers\etc\services file and there is "svcename tcpip_port_number/tcp" in that file. So, while you get message in your db2diag.log ""TCPIP" protocol support was successfully started.", it isn't network problem. I opened ports on my server mashine: DB2 server tcpip port(svcename) and DB2 DAS tcpip port through the Firewall settings. I found help on this reference https://learn.microsoft.com/en-us/sql/reporting-services/report-server/configure-a-firewall-for-report-server-access?view=sql-server-ver16.
Be careful and consult with your system admin about security.
(Sorry for my English)))

It was indeed a network error. I'm not fully sure which fix was the most important but I made sure telnet was enabled and white listed the DB2 process in the RHEL firewall configuration.

Related

Can't connect to HBase container on remote SSH server

I want to connect to HBase container on remote server that I connect to with ssh through VPN. Let's say it's 10.0.0.10.In /etc/hosts i placed:
10.0.0.10 hbaseaddr
In my java code I use hbase-client:
config.set("hbase.zookeeper.quorum", "hbaseaddr");
config.set("hbase.zookeeper.property.clientPort", "2181");
I get following error:
Can not resolve 791995b8a2df, please check your network
What is 791995b8a2df? Also, surprisingly, when I have a VPN turned off it just stays idle and does nothing, so it really is connecting to 10.0.0.10, then why do I have this error?
I read that it might be the issue with /etc/hosts. But I have /etc/hosts inside a local machine, /etc/hosts inside machine on 10.0.0.10 and /etc/hosts inside container with HBase.
What can I do to make it work?
Thanks in advance

Can we configure spring.datasource.url for external mysql server

For my Springboot project I can't connect to a mysql that I had hosted on a site. With a local mysql (workbench) it works well but when I replace the localhost url with that of the host it does not work and I have the following error message:
com.mysql.cj.jdbc.exceptions.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.
here is my code in application properties:
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/word?
spring.datasource.username=root
spring.datasource.password=root
I replace the following line of code with my Database Host:
spring.datasource.url=jdbc:mysql://db.example.net:3306/word?
spring.datasource.url=jdbc:mysql://db.example.net:3306/word?
It could be many things
IPTables/firewalld based firewall on either machines
Firewall on the network
Or simply IP is not reachable
If all the above 3 is done right then it could be a config on MySQL server side to not accept remote connections. Flip that flag (and possibly restart the MySQL service)
I would start from pinging the DB IP. If that's accessible you can rule out the line number 3. Then next I would look for the aforementioned config on mysql server side.
I just received a message from the support, they don't allow connection from any IP address. Thanks for answers!

Connecting to derby via I.P. Address fails

When I print the I.P. address of the system using InetAddress.getLocalHost(), I get user-VAIO/192.168.1.3 . Now, when I connect to derby using jdbc:derby://localhost:1527/mydatabase;create=true, it connects without any errors but when I connect the same using jdbc:derby://192.168.1.3:1527/mydatabase;create=true, it fails giving me the following exception:-
java.net.ConnectException : Error connecting to server 192.168.1.3 on port 1527 with message Connection refused: connect.
Any help will be appreciated.
When you start your Derby Network Server, you provide a value for the '-h' argument. You might not realize you are doing this, if you are using the packaged StartNetworkServer.bat file, but look inside the batch file, and you will see the -h argument there.
The batch file comes provided with the syntax '-h default' when you download Derby from the Apache website.
But you can change that, to say, for example, '-h 192.168.1.3', and then your Derby Network Server will accept connections that specify 'jdbc:derby://192.168.1.3/my/database'.
Note that if you want to accept such connections from other computers on the network, you will also have to adjust your Windows Firewall rules, as by default it will prevent such connections.

java and access error when connecting to the database

Today I encountered the following problem. When connecting to a database, the following error.Appeal to the remote database by connecting through vpn.
Added necessary firewall ports and even tried to disconnect its(did not help)
Added record to $JAVA_HOME/jre/lib/security/java.policy
grant codeBase "file:/-" {
permission java.security.AllPermission;
};(did not help)
If trying to connect with same data through sql management studio, it works and there is access. from the development environment no connection
Example(string connection = jdbc:sqlserver://DEVMSSQL14.test.com:1433;SCHEMA=test;DATABASENAME=test, sql managment studia = DEVMSSQL14.test.com,1433)
on another computer it works without problems, the same version of the project
It remains only to "Permission denied: connect".Maybe somebody faced with similar
Error:
The TCP/IP connection to the host DEVMSSQL14.test.com, port 1433 has failed. Error: "Permission denied: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
In the error message, you have shown like DEVMSSQL14.test.com, 1433 has failed.
I believe, it is correct. I dont think. this host name is correct. which says "TEST" as domain
Open the cmd, try to ping DEVMSSQL14.test.com
Success case :
If you are able to ping, then make sure the services are running for sql in services
Failure case:
Get the right host name to establish the connection
When i tried, i got this message, because i may be out of network.
Pinging DEVMSSQL14.test.com [208.64.121.161] with 32 bytes of data:
Request timed out.
Request timed out.
Try setting a System Property while running the code.
The catch is to introduce this line in code: System.setProperty("java.net.preferIPv4Stack", "true");
Or to pass it in VM option: -Djava.net.preferIPv4Stack=true

SQLServer - SQLServerException with jdbc access

I have installed on my pc ms sqlserver express 2012, I am trying to reach it via jdbc but I am not successfull, I get the error:
com.microsoft.sqlserver.jdbc.SQLServerException: connection to the host localhost, port 1433 has failed. Error:
"Connection refused: connect. Verify the connection properties.
Make sure that an instance of SQL Server is running on the host
and accepting TCP/IP connections at the port. Make sure that TCP
connections to the port are not blocked by a firewall
I am accessing via the following url: "jdbc:sqlserver://localhost:1433;database=mytest;"
I enabled the tcp/ip via the Sql server configuration manager, but if I run netstat-an I can't see the 1433 port listening.
I disabled windows firewall too...
I am lost :(
Any help?
Thank you!
****UPDATE**
I could overcome the problem by enabling port 1433 on IpAll under Sql Server configuration manager - Sql Server Network configuration - Protocols for SQLEXPRESS - tcp-ip Properties - Ip Addresses. But now I get another error:com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'sa'. ClientConnectionId
Any ideas? thanks!
The answer for the error:
com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user 'sa'. ClientConnectionId
is:
Go to Object explorer, click on properties (right click on Sql Server name), and on the security tab click on Sql Server and Windows authentication mode.
This worked for me.

Categories

Resources