I'm trying to configure SQLSERVER datasource in standalone.xml. In my project i'm using JTA and i founded configuration with and others with . What is the difference ? I'm using this:
<datasource jta="true" jndi-name="java:jboss/datasources/mydatabase" pool-name="seguDS" enabled="true" use-java-context="true">
<connection-url>jdbc:jtds:sqlserver://192.168.40.16/mydatabase;instance=clust02</connection-url>
<driver>jtds-1.3.1.jar</driver>
<new-connection-sql>select 1</new-connection-sql>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>5</min-pool-size>
<max-pool-size>50</max-pool-size>
</pool>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
<validation>
<check-valid-connection-sql>select 1</check-valid-connection-sql>
</validation>
<timeout>
<set-tx-query-timeout>true</set-tx-query-timeout>
<blocking-timeout-millis>5000</blocking-timeout-millis>
<idle-timeout-minutes>15</idle-timeout-minutes>
</timeout>
<statement>
<track-statements>false</track-statements>
</statement>
</datasource>
This works for me but i'm afraid if it correct or i should change to XA-DATASOURCE.
When you create a local-tx datasource in JBoss EAP 6.x or JBoss EAP 7, it defaults "jta" attribute to "true". This would help the local-tx resource to enlist in a global transaction. The "jta" attribute enables JTA integration for non-xa datasources only (https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6.1/html-single/Administration_and_Configuration_Guide/index.html#Datasource_Parameters1).
If your application uses global transactions, i.e. it needs a transaction manager to coordinate a distributed transaction across multiple resource managers, then you need XA Datasource.
Related
I am using WildFly 11, I am trying to understand when we configure a data source with a specific driver and we don't set the data source class name explicitly, which actual implementation of javax.sql.DataSource does WF ends up using ?
<datasource jndi-name="java:jboss/datasources/myDB" pool-name="myDB" enabled="true" use-java-context="true" spy="false">
<connection-url>jdbc:mysql://localhost:3306/db?useUnicode=true&characterEncoding=utf8&useSSL=false</connection-url>
<driver>mysql</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>2</min-pool-size>
<max-pool-size>5</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>root</password>
</security>
<validation>
<check-valid-connection-sql>select 1</check-valid-connection-sql>
<validate-on-match>false</validate-on-match>
<background-validation>true</background-validation>
<background-validation-millis>10000</background-validation-millis>
</validation>
</datasource>
my application certainly works and I can see the interaction with the DB just fine, however I am not sure which actual datasource implementation is in use, I tried to configure a logger against MySQL packages that contains the default data sources, but nothing seems to get logged as a result.
WildFly is using ironjacamar (http://www.ironjacamar.org/) as its datasource implementation.
I'm migrating some projects from JBoss 6.4 to JBoss 7.2, these projects needs different datasources to configurate DB connections. I added the datasources to the JBoss server config file (standalone.xml):
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<datasource jndi-name="java:/jdbc/SCL" pool-name="SCL" enabled="true">
<connection-url>jdbc:oracle:thin:#someIP:somePort:RCBDDES</connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>1</min-pool-size>
<max-pool-size>5</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>user</user-name>
<password>pass</password>
</security>
</datasource>
<datasource jta="true" jndi-name="java:/jdbc/Oracle" pool-name="jdbc/dsOracle" enabled="true" use-ccm="true" statistics-enabled="false">
<connection-url>jdbc:oracle:thin:#someIP:somePort:RCBDDES</connection-url>
<driver-class>oracle.jdbc.OracleDriver</driver-class>
<driver>oracle</driver>
<pool>
<min-pool-size>25</min-pool-size>
<max-pool-size>35</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>user</user-name>
<password>pass</password>
</security>
<validation>
<check-valid-connection-sql>SELECT 1 FROM DUAL</check-valid-connection-sql>
<validate-on-match>false</validate-on-match>
<background-validation>true</background-validation>
<exception-sorter class-name="org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter"/>
</validation>
<timeout>
<set-tx-query-timeout>false</set-tx-query-timeout>
<blocking-timeout-millis>6000</blocking-timeout-millis>
<idle-timeout-minutes>1</idle-timeout-minutes>
<query-timeout>60</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>
<track-statements>true</track-statements>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<datasource jta="true" jndi-name="java:/jdbc/dsSQLServer" pool-name="jdbc/dsSQLServer" enabled="true" use-ccm="true">
<connection-url>jdbc:sqlserver://someIP:somePort;DatabaseName=name</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<driver>sqlserver</driver>
<pool>
<min-pool-size>25</min-pool-size>
<max-pool-size>35</max-pool-size>
</pool>
<security>
<user-name>user</user-name>
<password>pass</password>
</security>
<timeout>
<idle-timeout-minutes>1</idle-timeout-minutes>
</timeout>
<statement>
<track-statements>true</track-statements>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<datasource jta="true" jndi-name="java:/jdbc/dsSQLServerHH" pool-name="jdbc/dsSQLServerHH" enabled="true" use-ccm="true">
<connection-url>jdbc:sqlserver://someIP:somePort;DatabaseName=name</connection-url>
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
<driver>sqlserver</driver>
<pool>
<min-pool-size>25</min-pool-size>
<max-pool-size>35</max-pool-size>
</pool>
<security>
<user-name>user</user-name>
<password>pass</password>
</security>
<timeout>
<idle-timeout-minutes>1</idle-timeout-minutes>
</timeout>
<statement>
<track-statements>true</track-statements>
<prepared-statement-cache-size>100</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="oracle" module="oracle.jdbc">
<driver-class>oracle.jdbc.OracleDriver</driver-class>
</driver>
<driver name="sqlserver" module="com.microsoft">
<driver-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver-class>
</driver>
</drivers>
</datasources>
The server starts without problems and I can execute store procedures used in the project, but I'm receiving constantly the following warning in the server console [ORA-12519] (even without making a request, only starting the server):
[#2020-05-21 17:25:12,983 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (JCA PoolFiller) IJ000610: Unable to fill pool: java:/jdbc/Oracle: javax.resource.ResourceException: IJ031084: Unable to create connection
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:345)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:352)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:287)
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.createConnectionEventListener(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1326) [ironjacamar-core-impl-1.4.11.Final-redhat-00001.jar:1.4.11.Final-redhat-00001]
at org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.fillTo(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1138) [ironjacamar-core-impl-1.4.11.Final-redhat-00001.jar:1.4.11.Final-redhat-00001]
at org.jboss.jca.core.connectionmanager.pool.mcp.PoolFiller.run(PoolFiller.java:97) [ironjacamar-core-impl-1.4.11.Final-redhat-00001.jar:1.4.11.Final-redhat-00001]
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_191]
Caused by: java.sql.SQLException: Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:419)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321)
... 6 more
Caused by: oracle.net.ns.NetException: Listener refused the connection with the following error:
ORA-12519, TNS:no appropriate service handler found
at oracle.net.ns.NSProtocol.connect(NSProtocol.java:386)
at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1054)
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:308)
... 11 more
#]
Can someone give me and advice?
It is obviously caused by the fact that the listener was not accepting connections, Could you connect your database through sqlplus? Also, you can navigate through the Jboss admin console/localhost:9990 by default/ and click test connection button to check your configuration. Maybe your database client version and DB version are not compatible. You may have connection leak that means there is no room for your pool size of respective datasource or at the database. And check out this link http://www.dba-oracle.com/sf_ora_12519_tns_no_appropriate_service_handler_found.htm
Can anybody help me to configure jms jndi properties in Cast Iron studio for accessing jms queue. I'm using jboss. How/where to get jms jndi properties in jboss? Also it's asking for jndi provider details such as username, password, provider name, value, and connection factory. Where to get these details?
try this
<datasource jndi-name="java:/project name" pool-name="project namre" enabled="true" use-java-context="true">
<connection-url>jdbc:oracle:thin:#databaseIP port service name</connection-url>
<driver>oracle</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>username</user-name>
<password>password</password>
</security>
<statement>
<prepared-statement-cache-size>10</prepared-statement-cache-size>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
I cant seem to get orbeon working with postgres.
In WEB-INF/jboss-web.xml I have
<resource-ref>
<res-ref-name>OrbeonDS</res-ref-name>
<jndi-name>java:/comp/env/jdbc/postgresql</jndi-name>
</resource-ref>
Then in WEB-INF/web.xml I have
...
<resource-ref>
<description>DataSource</description>
<res-ref-name>OrbeonDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
...
My standalone.xml file for jboss contains
<datasource jta="false" jndi-name="java:/comp/env/jdbc/postgresql" pool-name="postgresql" enabled="true" use-java-context="false" use-ccm="false">
<connection-url>jdbc:postgresql://localhost:5432/Orbeon</connection-url>
<driver>postgres</driver>
<transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>myuser</user-name>
<password>mypassword</password>
</security>
<statement>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
On startup the connection is bound and I have a working connection to the database. Orbeon also starts up ok and I am presented with the main screen. When I click on form runner to view my forms I get the database error popup.
In my log file, the error that appears is
error caught {controller: "oxf:/apps/fr/page-flow.xml", method: "GET", path: "/fr/service/postgresql/form"}
An error has occured
env/jdbc/mysql -- service jboss.naming.context.java.module.orbeon.orbeon.env.jdbc.postgresql
My properties-local.xml also contains the lines
<property as="xs:string" name="oxf.fr.persistence.provider.*.*.*" value="postgresql"/>
<property as="xs:string" name="oxf.fr.persistence.postgresql.datasource" value="postgresql"/>
Any ideas on what I can do to resolve this?
Thanks
I've already used a relational database persistence layer as well, but in tomcat not in Jboss.
Have you installed the JDBC driver as a module?
Follow the instruction from the following link, but using postgresql driver instead of mysql driver. http://wiki.orbeon.com/forms/doc/developer-guide/admin/installing#TOC-Setup-a-JDBC-datasource .
Also, the property oxf.fr.persistence.postgresql.datasource matches the resource name (jdbc/*) that you setup in server.xml. So, if the resource name is for example 'jdbc/postgresql', then oxf.fr.persistence.postgresql.datasource has to be 'postgresql'.
I have a JBoss server running and want to deploy a service.
The service connects to a database which is configured in the following xml file
<?xml version="1.0" encoding="UTF-8"?>
<datasources xmlns="http://www.jboss.org/ironjacamar/schema">
<datasource jta="false" jndi-name="java:/PMBootStrapDS"
pool-name="PMBootStrapDS" enabled="true" use-ccm="false">
<connection-url>jdbc:postgresql://localhost:5432/i2b2</connection-url>
<driver-class>org.postgresql.Driver</driver-class>
<driver>postgresql-9.2-1002.jdbc4.jar</driver>
<security>
<user-name>i2b2pm</user-name>
<password>demouser</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>
</datasources>
To deploy it on different systems easily, I want to bind the database location to an environment variable.
I tried something like this
<connection-url>jdbc:postgresql://${env.MY_DB_LOCATION}/i2b2</connection-url>
but it doesn't work.
Any suggestions on how to solve this issue?
Make sure you have property substitution enabled in your standalone.xml.
Look for the following subsytem in standalone.xml, and make sure the values are set to true
<subsystem xmlns="urn:jboss:domain:ee:1.1">
<spec-descriptor-property-replacement>true</spec-descriptor-property-replacement>
<jboss-descriptor-property-replacement>true</jboss-descriptor-property-replacement>
</subsystem>
EDIT: This is only supported for eap6 and jboss 7.1.2 (or later)