Apache Nifi, Connection Issue with Sql server JDBC - jdbc

I am trying to connect Apache Nifi to SQL Server hosted on localhost but getting this msg:
Establish Connection
Failed to establish Database Connection: java.sql.SQLException: Cannot create PoolableConnectionFactory (The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused (Connection refused). 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 disabled the firewall
I checked that tcp is enabled through SQL Configuration manager.
enter image description here
enter image description here
Nifi DBCPConnectionPool 1.16.3 Configurations:
Database Connection URL: jdbc:sqlserver://localhost:1433;databaseName=AdventureWorks2016
Database Driver Class Name: com.microsoft.sqlserver.jdbc.SQLServerDriver
Database Driver Location(s): file:///usr/lib/jvm/jre/lib/jdbc/sqljdbc_10.2/enu/mssql-jdbc-10.2.1.jre8.jar
enter image description here
But still not able to figure out what is the issue

Related

How to solve the problem of Elasticsearch ODBC DSN Configuration Connection Failed

I am new to Elasticsearch / ODBC and was trying to configure DSN, and I followed Configuration | Elasticsearch Guide to do it. Under 2.2 Connection parameters, it's stated that "At a minimum, the Name and Hostname fields must be provisioned, before the DSN can be saved.". Therefore, I only put in the the name and hostname, and left all other fields default.
Then, I pressed "Test Connection" but got the message of Connection Failed:
Connection Failed: [Elastic][EsODBC 7.16.2(v7.16.0-4-g42ac03a+,u,r) Driver]Couldn't connect to server (code:7; Failed to connect to ::1 port 9200: Connection refused).
Here is a screenshot of my configuration and connection test.
May I ask why is this happening and how can I solve it? Thanks much.
FYI I am using Windows 10 Pro version 21H2.

How to fix IO Error: The Network Adapter could not establish the connection

I am trying to connect my oracle cloud database using sqldeveloper with connection type basic but it fails connection with error:
Status : Failure -Test failed: IO Error: The Network Adapter could not establish the connection.
Anyone can help how can i connect my oracle db system using sqldevloper with connection type either basic or TNS ??
Have you tried to telnet the server on port 1521?
It sounds likely that the dbsystem is not connected to the internet.
Please check if the dbsystem subnet has:
Security List with a rule to allow port 1521 on your ip address
Routing Table that allows internet access via internet gateway

SSH tunnel not working with JDBC while trying to route HTTPS traffic

I am trying to connect to Snowflake which only has port 443 open for communications using JDBC driver. Instead of directly connecting to the snowflake server I want to connect to it via tunnel server. So I've created a ssh tunnel from local machine to snowflake server. And I'm passing the forwarded local address and port as the host for the JDBC connection String. This is my final JDBC string.
jdbc:snowflake://127.0.0.1:21212/?db=TEST_DB&warehouse=LOAD_WH&user=<user>&password=<password>
but the JDBC driver is not able to establish connection and fails during SSL handshake. Since the host address in the JDBC connection string doesn't have the format of that of the CN and SAN present in snowflake's SSL certificate.
Adding the stacktrace along:-
javax.net.ssl.SSLPeerUnverifiedException: Certificate for <10.11.227.124> doesn't match any of the subject alternative names: [*.snowflakecomputing.com, snowflakecomputing.com]
at net.snowflake.client.jdbc.internal.apache.http.conn.ssl.SSLConnectionSocketFactory.verifyHostname(SSLConnectionSocketFactory.java:467)
at net.snowflake.client.jdbc.internal.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:397)
at net.snowflake.client.jdbc.internal.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:355)
at net.snowflake.client.jdbc.internal.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:142)
at net.snowflake.client.jdbc.internal.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:359)
at net.snowflake.client.jdbc.internal.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:381)
at net.snowflake.client.jdbc.internal.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:237)
at net.snowflake.client.jdbc.internal.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
at net.snowflake.client.jdbc.internal.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at net.snowflake.client.jdbc.internal.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:111)
at net.snowflake.client.jdbc.internal.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at net.snowflake.client.jdbc.internal.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
at net.snowflake.client.jdbc.internal.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:108)
at net.snowflake.client.jdbc.internal.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at net.snowflake.client.jdbc.RestRequest.execute(RestRequest.java:141)
at net.snowflake.client.core.HttpUtil.executeRequestInternal(HttpUtil.java:280)
at net.snowflake.client.core.HttpUtil.executeRequest(HttpUtil.java:234)
at net.snowflake.client.core.SessionUtil.openSession(SessionUtil.java:906)
at net.snowflake.client.core.SFSession.open(SFSession.java:330)
at net.snowflake.client.jdbc.SnowflakeConnectionV1.<init>(SnowflakeConnectionV1.java:239)
at net.snowflake.client.jdbc.SnowflakeDriver.connect(SnowflakeDriver.java:344)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:270)
at org.apache.sqoop.manager.SqlManager.makeConnection(SqlManager.java:670)
at org.apache.sqoop.manager.GenericJdbcManager.getConnection(GenericJdbcManager.java:52)
at org.apache.sqoop.tool.EvalSqlTool.run(EvalSqlTool.java:70)
at org.apache.sqoop.Sqoop.run(Sqoop.java:175)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:65)
at org.apache.sqoop.Sqoop.runSqoop(Sqoop.java:211)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:250)
at org.apache.sqoop.Sqoop.runTool(Sqoop.java:259)
at org.apache.sqoop.Sqoop.main(Sqoop.java:268)
at com.cloudera.sqoop.Sqoop.main(Sqoop.java:57)
Anyone has done similar thing in past and can guide me on how to do that?
By default snowflake JDBC driver will use tls for communication since snowflake is on public cloud, we have to verify certificate to trust the connection. However, in your case, you are trying to connect to a local server (I guess no tls there), you can add turn ssl off in the connection property. You can try
Properties prop = new Properties();
prop.put("account", "testaccount");
...
prop.put("ssl", "off");
Connection conn = DriverManager.getConnection(url, prop);
I am not sure if this would work or not, but I think worth trying.

use jdbc to connect sybase ASE

I want to use jdbc to connect Sybase ASE, but, I got an error in the following:
JZ006: 捕获到 IO 例外:java.net.ConnectException: Connection refused: connect
Can anybody tell me how to solve this problem?
"Connection refused: connect" is a low level socket error meaning that nothing is listening on the port you are trying to connect to (or it was blocked by a firewall).
This means that either you have no Sybase ASE running, it is not listening on the IP address you are connecting to, it is listening on a different port, or a firewall blocks your connection.

Oracle connection error

java.sql.SQLException: Io exception: The Network Adapter could not establish the
connection at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java)
I am getting this error when data in database is increased (nearly 3000). It works fine with limited data (say 100).
The Network Adapter could not establish the connection
Is typically thrown when
the Oracle listener is not running
the wrong hostname was specified in the connection url
the wrong port was specified in the connection url
the port is blocked by firewall
I have never seen it related to "increasing" the data in the database

Resources