I wanted to configure XA datasource for Mariadb in REDHAT JBoss EAP 7.0. I
I have created a non-XA datasource with below details and connection is working fine.
Driver: mysql-connector-java-5.1.46.jar_com.mysql.jdbc.Driver_5_1
Connection URL: jdbc:mysql://localhost:3306/test
But when I tried to create new XA datasource for distributed transactions then it fails with error detail.
Unexpected HTTP response: 500
Request
{
"address" => [
("subsystem" => "datasources"),
("xa-data-source" => "MysqlXADS1")
],
"operation" => "test-connection-in-pool"
}
Response<br>
Internal Server Error<br>
{`enter code here`
"outcome" => "failed",
"failure-description" => "WFLYJCA0040: failed to invoke operation: WFLYJCA0042: failed to match
pool. Check JndiName: java:/MysqlXADS1",
"rolled-back" => true
}
Configuration Details :
Driver: mysql-connector-java-5.1.46.jar_com.mysql.jdbc.jdbc2.optional.MysqlXADataSource_5_1
Url: jdbc:mariadb://localhost:3306/test
Valid Connection Checker: org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker
Exception Sorter: org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter
JBoss EAP support for MariaDB started on version 7.0 so your version is not a problem.
From the error WFLYJCA0040: failed to invoke operation: WFLYJCA0042: failed to match pool. Check JndiName, and assuming the jdbc name is correctly assigned, I believe your issue will be solved on step 1.3 and 2, as below:
When setting up a data source on JBoss EAP 7.0:
deploy the driver
create the datasource
Verify the pool size, removing the line <max-pool-size>0</max-pool-size> as explained here.
reload
For your version, JBoss EAP 7.0 : Remember to enable the DB:
#/subsystem=datasources/data-source=MyExampleDS:enable()
#/subsystem=datasources/data- source=MyExampleDS:test-connection-in-pool()
Related
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.
according to https://www.testcontainers.org/modules/databases/jdbc/#database-containers-launched-via-jdbc-url-scheme , i'm trying to create an Oracle Container with Quarkus using jdbc url scheme.
After provided a valid docker image ("store/oracle/database-instantclient:12.2.0.1") and set this properties:
"%test":
quarkus:
datasource:
jdbc:
driver: org.testcontainers.jdbc.ContainerDatabaseDriver
url: jdbc:tc:oracle:///databasename
db-kind: other
i get this error:
Container is started (JDBC URL: jdbc:oracle:thin:system/oracle#localhost:32827:xe)
2020-11-09 17:33:06,719 INFO [🐳 .2.0.1]] (Agroal_13889837441) Container store/oracle/database-instantclient:12.2.0.1 started in PT4M7.8483772S
2020-11-09 17:33:06,738 WARN [io.agr.pool] (Agroal_13889837441) Datasource '<default>': Could not create new connection
2020-11-09 17:33:06,805 ERROR [io.qua.application] (main) Failed to start application (with profile test): org.flywaydb.core.internal.exception.FlywaySqlException:
Unable to obtain connection from database: Could not create new connection
--------------------------------------------------------------------------
SQL State : null
Error Code : 0
Message : Could not create new connection
at org.flywaydb.core.internal.jdbc.JdbcUtils.openConnection(JdbcUtils.java:65)
at org.flywaydb.core.internal.jdbc.JdbcConnectionFactory.<init>(JdbcConnectionFactory.java:80)
at org.flywaydb.core.Flyway.execute(Flyway.java:453)
at org.flywaydb.core.Flyway.migrate(Flyway.java:158)
Can someone help me?
If I remember correctly, Flyway community editions (that ships with Quarkus) does not have support for Oracle. You need to use the Enterprise edition.
You need to replace the Quarkus Flyway dependency. Just exclude the one included and add the enterprise one (either in Maven or Gradle).
I'm trying to install the jdbc plugin for Logstash on a AWS EC2 server so I can query a MySQL database.
Logstash is working but I can't get the JDBC plugin to work. When I run Logstash I get this error:
Error: com.mysql.jdbc.Driver not loaded. Are you sure you've included
the correct jdbc driver in :jdbc_driver_library?
I tried installing the JDBC plugin based on this:
https://discuss.elastic.co/t/getting-started-with-jdbc-input-plugin/77162
The install looked like it worked:
[ec2-user# settings]$ sudo /usr/share/logstash/bin/logstash-plugin install logstash-input-jdbc
Validating logstash-input-jdbc
Installing logstash-input-jdbc
Installation successful
But when I try to find the .jar file for the mysql connector it does not seem to exist on the system:
[ec2-user# logstash]$ sudo find / -name "*connector-java*"
This is what my Logstash config file looks like:
input {
jdbc {
jdbc_driver_library => "mysql-connector-java-5.1.36-bin.jar"
jdbc_driver_class => "com.mysql.jdbc.Driver"
jdbc_connection_string => "jdbc:mysql://***:3306/website"
jdbc_user => "***"
jdbc_password => "***"
statement => "SELECT * from runtime_ProdFull WHERE `MfPN` LIKE 'KO8%'"
}
}
How do I identify the correct name for jdbc_driver_library and how do I find it's path so I can add it to my config?
Thanks,
Phil
SOLUTION:
I downloaded the latest platform independent version from https://dev.mysql.com/downloads/connector/j/ to my PC, unzipped the mysql-connector-java-8.0.15.jar file and uploaded to the EC2 server via WinSCP to /var/lib/logstash/.
Then changed the jdbc driver to:
jdbc_driver_library => "/var/lib/logstash/mysql-connector-java-8.0.15.jar"
You have to download JDBC driver by yourself. Go to this website and download appropriate driver for your database and then put it somewhere in your EC2. Then you just have to specify path to the downloaded driver in this field jdbc_driver_library and you're good to go.
I'm doing some testing and got the following exception:
java.lang.IllegalArgumentException: Invalid connection URL url dbc:h2:db/test
at org.mariadb.jdbc.JDBCUrl.parse(JDBCUrl.java:144)
at org.mariadb.jdbc.Driver.connect(Driver.java:95)
at java.sql.DriverManager.getConnection(DriverManager.java:664)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
The code I'm using:
Class.forName("org.h2.Driver"); //load h2 driver
String connectionUrl = "jdbc:h2:db/test";
Connection conn = DriverManager.getConnection(connectionUrl, "sa", "");
I also test something related to mariadb/mysql, so the mariadb driver is also on classpath in addition to the h2 driver (eclipse project). If I remove the mariadb driver from classpath the connection works.
To my knowledge it should be possible to have multiple jdbc drivers on classpath or have I understood something wrong?
(h2 is version 1.3.176 and mariadb-java-client is 1.2.0)
EDIT: Using mariadb-java-client 1.2.2 removes the problem
I can confirm that this was a bug in the mariadb-jdbc-driver
https://mariadb.atlassian.net/plugins/servlet/mobile#issue/CONJ-167
I would assume this was some kind of bug, since I have not seen the problem after updating to mariadb-java-client 1.2.2 .
Does Apache Fuse 5.5 supports stomp 1.1 completely?
I am trying to send "NACK" from python client. The connection is made on version 1.1
##############Connected##########
{'body': '', 'headers': {'session': 'ID:ap-pun-ws6099-60937-1327039578399-2:5',
'version': '1.1', 'server': 'ActiveMQ/5.5.1-fuse-01-13', 'heart-beat': '1000,100
0'}, 'cmd': 'CONNECTED'}
but when i send "NACK" it throws exception saying 2012-01-20 13:46:03,815 receiver ERROR Received server error - messageNACK received but connection is in v1.0 mode.
Please help me regarding this.
A bug was found for this and resolved today: https://issues.apache.org/jira/browse/AMQ-3670