Connection error from Oracle DB - Logstash - oracle

Has anyone faced this issue while connecting to an Oracle DB from Logstash JDBC Input Plugin :
[2021-07-22T11:22:42,912][ERROR][logstash.inputs.jdbc ][main][9615a4202c23f17db8abee168682c63c25349f105e2579d02086d38fe8145d97] Unable to connect to database. Trying again {:error_message=>"Java::JavaSql::SQLRecoverableException: IO Error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond, Authentication lapse 0 ms."}
[2021-07-22T11:22:42,922][ERROR][logstash.inputs.jdbc ][main][b9b24f18d4550bc4a001bc364e9e4d369504fce0c99e762583d6da267f2f7e5e] Unable to connect to database. Tried 1 times {:error_message=>"Java::JavaSql::SQLRecoverableException: IO Error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond, Authentication lapse 0 ms."}
[2021-07-22T11:22:42,924][ERROR][logstash.inputs.jdbc ][main][5d2187e4deef8e15edbd453b49ce621da2d805def7d3a2a1a45abb4b261c5a7f] Unable to connect to database. Tried 1 times {:error_message=>"Java::JavaSql::SQLRecoverableException: IO Error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond, Authentication lapse 0 ms."}
[2021-07-22T11:22:42,943][ERROR][logstash.javapipeline ][main][5d2187e4deef8e15edbd453b49ce621da2d805def7d3a2a1a45abb4b261c5a7f] A plugin had an unrecoverable error. Will restart this plugin.
Pipeline_id:main
Plugin: <LogStash::Inputs::Jdbc jdbc_user=>"<User>", jdbc_paging_enabled=>true, jdbc_password=><password>, statement=>"select<Fields> from <Table>", jdbc_driver_library=>"<Path>/lib/ojdbc8-21.1.0.0.jar", jdbc_connection_string=>"jdbc:oracle:thin:#<HOST>:<PORT>:<SID>", id=>"5d2187e4deef8e15edbd453b49ce621da2d805def7d3a2a1a45abb4b261c5a7f", jdbc_driver_class=>"Java::oracle.jdbc.driver.OracleDriver", type=>"cis-api-gateway-request", enable_metric=>true, codec=><LogStash::Codecs::Plain id=>"plain_00b6436f-afd3-4f1d-8450-d627939f640e", enable_metric=>true, charset=>"UTF-8">, jdbc_page_size=>100000, jdbc_validate_connection=>false, jdbc_validation_timeout=>3600, jdbc_pool_timeout=>5, sql_log_level=>"info", connection_retry_attempts=>1, connection_retry_attempts_wait_time=>0.5, plugin_timezone=>"utc", last_run_metadata_path=>"<Path>/.logstash_jdbc_last_run", use_column_value=>false, tracking_column_type=>"numeric", clean_run=>false, record_last_run=>true, lowercase_column_names=>true, use_prepared_statements=>false>
Error: Java::JavaSql::SQLRecoverableException: IO Error: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond, Authentication lapse 0 ms.
Exception: Sequel::DatabaseConnectionError
Stack: oracle.jdbc.driver.T4CConnection.handleLogonIOException(oracle/jdbc/driver/T4CConnection.java:913)
I am able to connect with the same credentials and connection details through SQL developer.
Here is my Logstash JDBC Input:
jdbc {
jdbc_connection_string => "jdbc:oracle:thin:#<ORACLE_HOST>:<ORACLE_PORT>:<ORACLE_SID>"
jdbc_user => "<USER>"
jdbc_password => "<PASSWORD>"
jdbc_driver_library => "<PATH>/lib/ojdbc8-21.1.0.0.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
jdbc_paging_enabled => true
connection_retry_attempts => 5
connection_retry_attempts_wait_time => 10
statement=> "select<Fields> from <Table>"
type => "<Temp Val>"
}
My Oracle version is 19.3 and Logstash-7.9.1 (windows)

I see that you are using ojdbc8.jar from oracle jdbc driver 21.1 release. Try a simple standalone java test to connect your db and see if you get same error or not. If the issue reproduce then paste the full error stack trace. SQLDeveloper might be using a different release ojdbc jar.

Related

logstash unable to reach elastic server unable to find valid certification path to requested target

I am trying to use logstash to connect my MSSQL server with elastic for real time sync. I have installed elastic 8.3.3 and kibana 8.3.3, I am able to log in to kibana and create some sample index users_test and one sample text variable "name". Elastic is running on https://localhost:9200/, i verified by logging into and got the success message.
I have created a sample config file for logstash
input {
jdbc {
jdbc_driver_library => "D:\sqljdbc_12.2.0.0_enu\sqljdbc_12.2\enu\mssql-jdbc-12.2.0.jre8.jar"
jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
jdbc_connection_string => "jdbc:sqlserver://<dbpath>/<dbname>"
jdbc_user => <db_userid>
jdbc_password => <db_passwd>
statement => "SELECT * FROM Users"
}
}
output {
elasticsearch {
hosts => ["https://localhost:9200/"]
index => "users_test"
}
}
i run it with logstash.bat -f sql.conf and get the error message. logstash is also
Attempted to resurrect connection to dead ES instance, but got an error {:url=>"https://localhost:9200/", :exception=>LogStash::Outputs::ElasticSearch::HttpClient::Pool::HostUnreachableError, :message=>"Elasticsearch Unreachable: [https://localhost:9200/][Manticore::ClientProtocolException] PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target"}
The error message says
unable to find valid certification path to requested target
The reason is explained here
sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target and javax.net.ssl.SSLException: Received fatal alert: certificate_unknown
This SunCertPathBuilderException indicates that a certificate was returned during the handshake that is not trusted. This message is seen on the client side of the connection. The SSLException is seen on the server side of the connection. The CA certificate that signed the returned certificate was not found in the keystore or truststore and needs to be added to trust this certificate.
You need to add the cacert parameter to your elasticsearch output to validate the certificate returned from the server and you also probably need to add a username and password as well:
elasticsearch {
hosts => ["https://localhost:9200/"]
index => "users_test"
cacert => "/path/to/the/ca/cert"
user => "username"
password => "password"
}

Logstash connection with Oracle wallet

I'm having issues connecting Logstash using Oracle wallet. I am getting an invalid login/password even though I am trying to connect through the wallet, without using said login/password.
[ERROR][logstash.inputs.jdbc ] Unable to connect to database. Tried 2 times {:error_message=>"Java::JavaSql::SQLException: ORA-01017 Invalid Username/Password"}
Here's my Logstash jdbc input file :
input {
jdbc {
jdbc_driver_library => "${ORACLE_HOME}/dmu/jlib/ojdbc10.jar,${ORACLE_HOME}/ucp/lib/ucp.jar,${ORACLE_HOME}/jlib/oraclepki.jar,${ORACLE_HOME}/jlib/osdt_cert.jar,${ORACLE_HOME}/jlib/osdt_core.jar"
jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
jdbc_connection_string => "jdbc:oracle:thin:/#name_high?TNS_ADMIN=${ORACLE_HOME}/network/admin/wallet"
jdbc_user => ""
schedule => "* * * * * *"
statement => "SELECT * from table"
connection_retry_attempts => 2
connection_retry_attempts_wait_time => 5
jdbc_pool_timeout => 20
jdbc_validation_timeout => 600
}
}
So I use the following drivers :
ojdbc10.jar
ucp.jar
oraclepki.jar
osdt_cert.jar
osdt_core.jar
I made sure every environement variable paths are correct, every access rights correctly set.
I believe the connection string syntaxe is correct since it does find the tnsnames.ora and attempt a connexion to the right host, port, sid.
I omitted the field jdbc_password in the jdbc input as it is not required and I don't want jdbc to think I want to use it. I left the jdbc_user field but empty as it is apparently required even though I'm trying not to use it.
I'm able to connect to the database using sqlplus as follows:
sqlplus /#name_high
So what I was missing was the java property wallet_location wich append to be the same path as the TNS_ADMIN in my case.
It needs to be loaded by the script that launch the JRE when starting Logstash as such :
-Doracle.net.wallet_location=${WALLET_PATH}
You can refer to the blog for steps with different versions of the driver. Also, you can refer to the blog to know different ways to set connection properties.

Bug CleverBeagle Pup 2.0 Meteor GraphQL deployment on Heroku

1) In the first time, when I deployed the origin code to heroku server with git clone https://github.com/cleverbeagle/pup
The launching application didn't work.
I managed to correct this with to copy the content of 'settings-development.json' file and paste in Heroku => myProject => Setttings => Reveal Config Vars => Key : METEOR_SETTINGS and Value : I pasted here the content.
thanks to :
- https://github.com/cleverbeagle/pup/issues/9
- https://github.com/cleverbeagle/pup/issues/197
So, now, the app is showing on server.
2) On Chrome console, I have this error :
50d72c91808ef7fba57f920b67d152d2d57698eb.js?meteor_js_resource=true:9 WebSocket connection to 'ws://localhost:4001/graphql' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
so I changed this in METEOR_SETTINGS
"graphQL": {
"httpUri": "http://localhost:3000/graphql",
"wsUri": "ws://localhost:4001/graphql"
},
to
"graphQL": {
"httpUri": "https://myproject.herokuapp.com:3000/graphql",
"wsUri": "wss://myproject.herokuapp.com:4001/graphql"
},
Note without https and wss, the app is not showing
3) Now on Chrome Console, I have :
this warning :
50d72c91808ef7fba57f920b67d152d2d57698eb.js?meteor_js_resource=true:9 WebSocket connection to 'wss://myproject.herokuapp.com:4001/graphql' failed: WebSocket is closed before the connection is established.
and after several warning above, I have this error :
50d72c91808ef7fba57f920b67d152d2d57698eb.js?meteor_js_resource=true:9 WebSocket connection to 'wss://myproject.herokuapp.com:4001/graphql' failed: WebSocket opening handshake timed out
By using the origin source code from Pup, I can signup on server but I cannot create a new document.
Any help, please ?
Thank you
EDIT 15 JAN 2019
**4) I remove Port like this : **
"httpUri": "https://myproject.herokuapp.com/graphql",
"wsUri": "wss://myproject.herokuapp.com/graphql"
Now, I can create New document on https://myproject.herokuapp.com/documents
but I still have this warning :
fe6fa1ac83e19aa2513ac3f97293600e8dc99e8e.js?meteor_js_resource=true:9
WebSocket connection to 'wss://myproject.herokuapp.com/graphql'
failed: WebSocket is closed before the connection is established.
and this error :
WebSocket connection to 'wss://myproject.herokuapp.com/graphql'
failed: Error during WebSocket handshake: Unexpected response code:
503
any idea ?
Thanks

Trying to Connect Vertica DB with Weblogic 10.3

Working on Linux Redhat
I have two below jars
1>vertica-jdbc-5.1.1.jar
2>vertica-jdk5-6.1.1-0.jar
Steps that i followed:
1 copied the jars to $WL_HOME/server/lib
2 I set the path of the jars to Linux Path like below
export WL_HOME=/usr/local/WL_Server10.3/sever
PATH= ${WL_HOME}/lib:${PATH}
3 I modified ${WL_HOME}/common/bin/commEnv.sh
Added my jars entry like below
# set up WebLogic Server's class path
WEBLOGIC_CLASSPATH="${JAVA_HOME}/lib/tools.
jar${CLASSPATHSEP}${WL_HOME}/server/lib/weblogic_sp.
jar${CLASSPATHSEP}${WL_HOME}/server/lib/weblogic.
jar${CLASSPATHSEP}${FEATURES_DIR}/weblogic.server.modules_13.1.1.0.
jar${CLASSPATHSEP}${WL_HOME}/server/lib/webservices.
jar${CLASSPATHSEP}${ANT_HOME}/lib/ant-all.
jar${CLASSPATHSEP}${ANT_CONTRIB}/lib/ant-contrib.jar
${CLASSPATHSEP}${WL_HOME}/server/lib/vertica-jdbc-5.1.1.jar
${CLASSPATHSEP}${WL_HOME}/server/lib/vertica-jdk5-6.1.1-0.jar"
export WEBLOGIC_CLASSPATH
//I also tried the below steps googling,................. Optional Step
4> Modified ${WL_HOME}/server/lib/jdbcdrivers.xml
Added required parameter
i didnt get what to fill in the URLClassPathName value so i ignored it.
5>I restarted the Weblogic server and logged into the admin console
6> I added new JDBC Data Source
While Testing the Connection i am getting below Error:
Message icon - Error An error occurred during activation of changes, please see the log for details.
Message icon - Error weblogic.application.ModuleException:
Message icon - Error weblogic.common.ResourceException: Could not create pool connection. The DBMS driver exception was: [Vertica][JDBC](10100) Connection Refused: (11640) Required Connection Key(s): user; (11480) Optional Connection Key(s): autocommit, connsettings, directbatchinsert, logintimeout, loglevel, lognamespace, logpath, readonly, resultbuffersize, sessionlabel, ssl, threepartnaming, transactionisolation
It would be great if someone can help me with the steps to connect Vertica Database to the Weblogic 10.3
What connection settings are you providing in:
"6> Added new JDBC Data Source
7>Followed the steps"
The error says you're missing specificying a user:
[Vertica][JDBC](10100) Connection Refused:
(11640) Required Connection Key(s): user;
(11480) Optional Connection Key(s): autocommit, connsettings, directbatchinsert, logintimeout, loglevel, lognamespace, logpath, readonly, resultbuffersize, sessionlabel, ssl, threepartnaming, transactionisolation

Ruby IMAP login error exception

With my Ruby script:
imap = Net::IMAP.new('imap.gmail.com')
imap.login("some_email#host.com", password)
I get the following exception:
A connection attempt failed because
the connected party did not properly
respond after a period of time, or
established connection failed because
connected hos has failed to respond. -
connect(2)
What's wrong?
You need to connect using SSL on port 993.
Therefore your code should be this:
imap = Net::IMAP.new('imap.gmail.com', 993, true)
imap.login("user#host.com", "password")

Resources