Using the below jboss configuration while fetching the data from resultset it takes more time but using standalone application it's executed quickly.
it takes 20 seconds in jboss and 0.98 seconds in standalone application
I am using database SQL Server 2019
configuration:
<datasource jta="true" jndi-name="java:jboss/datasources/FXDS" pool-name="FXDS" enabled="true" spy="false" statistics-enabled="true">
<connection-url>jdbc:sqlserver://10.10.10.10:1433;DatabaseName=SQLDB;</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<driver>sqlserver</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>200</max-pool-size>
<prefill>true</prefill>
<flush-strategy>Gracefully</flush-strategy>
</pool>
<security>
<user-name>SA</user-name>
<password>password</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker"/>
<background-validation>true</background-validation>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLExceptionSorter"/>
</validation>
<timeout>
<set-tx-query-timeout>true</set-tx-query-timeout>
<query-timeout>1800</query-timeout>
</timeout>
</datasource>
Related
I´ve succesfully set up a Postgres datasource on Wildfly 10.1 final. The application that uses the datasource is still under development and therefore not really in use yet.
Wildfly and postgres each are running in their own VM but on the same host machine.
About once a day, the connection apparently gets lost, and only a restart of wildfly will suffice to re-establish it.
In wildfly´s server.log I can´t find any message related to my datasource. Here is the datasource configuration from standalone.xml
<datasource jta="true" jndi-name="java:/JMPostgres" pool-name="PostgresDS" enabled="true" use-ccm="false">
<connection-url>jdbc:postgresql://10.66.1.102:5432/jm10</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<driver>postgresql-42.1.4.jar</driver>
<pool>
<min-pool-size>5</min-pool-size>
<initial-pool-size>5</initial-pool-size>
<max-pool-size>50</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>jm10</user-name>
<password>Ba4aeng$eeth0iog.ee2zohB</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
<check-valid-connection-sql>SELECT 1 FROM DUAL;</check-valid-connection-sql>
<validate-on-match>true</validate-on-match>
<background-validation>true</background-validation>
<background-validation-millis>60000</background-validation-millis>
<stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.StaleConnectionChecker"/>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
</validation>
<timeout>
<allocation-retry>5</allocation-retry>
<allocation-retry-wait-millis>10000</allocation-retry-wait-millis>
</timeout>
</datasource>
Previously I provided with user name and password and it was working fine. Now The Db side provided access with username only. I mean Username alone I can able to db server and not require password..
Fyr:
jboss path :
\jboss-eap-6.2\standalone\configuration\standalone.xml
<user-name>prabhu</user-name>
<password>x1234</password>
Now If try to provide only username, I am unable to connect Db. your help highly appreciated.
<datasource jta="true" jndi-name="java:/repdb" pool-name="db2_pool_repdb_amlinst" enabled="true" use-java-context="true" use-ccm="true">
<connection-url>jdbc:db2://01.83.42.122:50000/PRODDB:currentSchema=XYZ;</connection-url>
<driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
<driver>db2</driver>
<security>
<user-name>prabhu</user-name>
<password>x1234</password>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
I'm a Java and JBoss newbie struggling to get JBoss AS 7.0.1 working with mySQL 5.5 on my Windows 10 machine.
I get the following error when I start JBoss:-
16:19:39,480 INFO [org.jboss.as.controller] (Controller Boot Thread) Service status report
New missing/unsatisfied dependencies:
service jboss.jdbc-driver.com_mysql (missing)
This is what I've done
1 created directory jboss-as-7.0.1.Final\modules\com\mysql\main
2 Files there: module.xml and mysql-connector-java-5.1.26-bin.jar (downloaded from official mysql site)
3 Content of module.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql" slot="main">
<resources>
<resource-root path="mysql-connector-java-5.1.39-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
4 Relevant parts from jboss-as-7.0.1.Final\standalone\configuration\standalone.xml:
<datasources>
<datasource jndi-name="java:/jbossdbDS" pool-name="my_pool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>
jdbc:mysql://localhost:3306/jbossdb
</connection-url>
<driver>
com.mysql
</driver>
<security>
<user-name>
root
</user-name>
<password>
password
</password>
</security>
<timeout>
<idle-timeout-minutes>
0
</idle-timeout-minutes>
<query-timeout>
600
</query-timeout>
</timeout>
<statement>
<prepared-statement-cache-size>
100
</prepared-statement-cache-size>
<share-prepared-statements/>
</statement>
</datasource>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="H2DS" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>
jdbc:h2:mem:test;DB_CLOSE_DELAY=-1
</connection-url>
<driver>
h2
</driver>
<pool>
<prefill>
false
</prefill>
<use-strict-min>
false
</use-strict-min>
<flush-strategy>
FailingConnectionOnly
</flush-strategy>
</pool>
<security>
<user-name>
sa
</user-name>
<password>
sa
</password>
</security>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql"/>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>
org.h2.jdbcx.JdbcDataSource
</xa-datasource-class>
</driver>
</drivers>
</datasources>
You have mentioned the mysql jar file name in modules as
mysql-connector-java-5.1.26-bin.jar
But in your module.xml it is incorrectly configured as
mysql-connector-java-5.1.39-bin.jar
Pls Correct your module.xml
Your driver configured in datasource with name
<driver>
com.mysql
</driver>
Update that to your correct driver name as
<driver>
mysql
</driver>
Thanks for the responses.
Turns out the mysql-connector-java-5.1.39-bin.jar file was corrupt, the java.sql.Driver file inside it was empty. Not sure how that happened!
I have JBoss, and I am using JNDI to connect to database, but when database restarts, I have to restart JBoss to take new connection pool, are there any properties to do reconnection?, please help
<subsystem xmlns="urn:jboss:domain:datasources:1.2">
<datasources>
<datasource jta="false" jndi-name="java:jboss/datasources/ams" pool-name="OracleDS" enabled="true" use-ccm="false">
<connection-url>jdbc:oracle:thin:#rhhqrac01scant:1521/testingenv</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<driver>oracle</driver>
<pool>
<min-pool-size>100</min-pool-size>
<max-pool-size>150</max-pool-size>
<prefill>true</prefill>
<flush-strategy>FailingConnectionOnly</flush-strategy>
</pool>
<security>
<user-name>ams</user-name>
<password>testpassword</password>
</security>
<validation>
<check-valid-connection-sql>select 1 from dual</check-valid-connection-sql>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<timeout>
<set-tx-query-timeout>false</set-tx-query-timeout>
<blocking-timeout-millis>0</blocking-timeout-millis>
<idle-timeout-minutes>0</idle-timeout-minutes>
<query-timeout>0</query-timeout>
<use-try-lock>0</use-try-lock>
<allocation-retry>0</allocation-retry>
<allocation-retry-wait-millis>0</allocation-retry-wait-millis>
</timeout>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="oracle" module="com.oracle.ojdbc6">
<xa-datasource-class>oracle.jdbc.OracleDriver</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
You can add that under your datasource tag
<check-valid-connection-sql>select 1</check-valid-connection-sql>
Try this
<validate-on-match>true </validate-on-match>
knowing that this recovers connection, but unfortunately, it will put more load on the database because it validates the connection each time the connection is checked out from the pool.
I am using JBOSS 7.0 application server. I have declared my datasources in standalone.xml as follows,
<datasource jndi-name="java:jboss/datasources/ltmsfleettrackingds" pool-name="ltmsfleettrackingdspool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
<connection-url>
jdbc:mysql://localhost:3306/fleettrackingdb?zeroDateTimeBehavior=convertToNull&useUnicode=true&characterEncoding=utf-8
</connection-url>
<driver>
mysqldriver
</driver>
<transaction-isolation>
TRANSACTION_READ_COMMITTED
</transaction-isolation>
<pool>
<min-pool-size>
10
</min-pool-size>
<max-pool-size>
50
</max-pool-size>
<prefill>
true
</prefill>
<use-strict-min>
false
</use-strict-min>
<flush-strategy>
FailingConnectionOnly
</flush-strategy>
</pool>
<security>
<user-name>
root
</user-name>
<password>
</password>
</security>
<validation>
<validate-on-match>
false
</validate-on-match>
<background-validation>
false
</background-validation>
<useFastFail>
false
</useFastFail>
</validation>
<statement>
<prepared-statement-cache-size>
100
</prepared-statement-cache-size>
<share-prepared-statements/>
</statement>
</datasource>
Is it possible to get the mentioned datasource jndi name declared in standalone.xml programmatically in java language.