[jboss-jira] [JBoss JIRA] (WFLY-7018) Valid Wildfly 10.0.0.Final DataSource fails in Wildfly 10.1.0.Final
Lin Gao (JIRA)
issues at jboss.org
Thu Sep 8 02:29:00 EDT 2016
[ https://issues.jboss.org/browse/WFLY-7018?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13290238#comment-13290238 ]
Lin Gao commented on WFLY-7018:
-------------------------------
Oh, right, forgive me. I forget that another linked issue: WFLY-6200 is not resolved yet, the connection-url is still mandatory now. :P
{noformat}
Question 1: It sounds like Wildfly DataSources will be configured differently in future, with different cli commands. Is this correct?
{noformat}
I think it is still the same CLI command, just with ability to specify the --connection-properties now.
{noformat}
Question 2: Is there a better work-around than the above example, so that I can get a Wildfly 10.0.0.Final DataSource working again in Wildfly 10.1.0.Final?
{noformat}
I think no better option for now without WFLY-6200 fixed.
{noformat}
Question 3: Could you provide a sample Wildfly 10.1.0.Final DataSource XML configuration (<subsystem xmlns="urn:jboss:domain:datasources:4.0"><!-- ... --></subsystem>) that would work?
{noformat}
Without fixing of WFLY-6200, the sample in the bug description is one way that works, which uses DataSource to get database connection. Another possible configuration can be:
{code:xml}
<subsystem xmlns="urn:jboss:domain:datasources:4.0">
<datasources>
<datasource jndi-name="java:/MY_APP_DS" pool-name="Postgres_MY_APP_DS">
<connection-url>jdbc:postgresql://localhost:5432/myapp</connection-url>
<driver>postgres</driver>
<security>
<user-name>myapp</user-name>
<password>myapp</password>
</security>
<validation>
<valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
<exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
</validation>
</datasource>
<drivers>
<driver name="postgres" module="org.postgres">
<driver-class>org.postgresql.Driver</driver-class>
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
{code}
where I removed the {{datasource-class}} from {{driver}} element. So it will try to use DriverManager.getConnection() to get database connection.
{noformat}
Question 4: Could you provide a sample Wildfly 10.1.0.Final DataSource CLI configuration that would work?
{noformat}
Actually there is only one extra parameter to specify:
{code:java}
data-source add \
--name=MyDS \
--driver-name=postgresql \
--jndi-name=java:jboss/jdbc/MyDS \
--user-name=wildfly \
--password=**** \
--connection-url=jdbc:postgresql://localhost:5432/wildfly \
--connection-properties={"url"=>"jdbc:postgresql://localhost:5432/wildfly"}
{code}
NOTE: I need to define both {{--connection-url}} and {{--connection-properties}} now before WFLY-6200 gets fixed.
I think IronJacamar should be more tolerant on usage the datasoruce-class or connection-url, but I need to discuss it with Jesper and Stefano before we can get the conclusion on that.
> Valid Wildfly 10.0.0.Final DataSource fails in Wildfly 10.1.0.Final
> -------------------------------------------------------------------
>
> Key: WFLY-7018
> URL: https://issues.jboss.org/browse/WFLY-7018
> Project: WildFly
> Issue Type: Bug
> Components: JCA
> Affects Versions: 10.1.0.Final
> Reporter: Mark S
> Assignee: Lin Gao
>
> My current Wildfly 10.0.0.Final (Non-XA) Datasource configuration will not work for Wildfly 10.1.0.Final. See the "Steps to Reproduce" section.
> The stacktrace points to here:
> * https://source.jboss.org/browse/IronJacamar/adapters/src/main/java/org/jboss/jca/adapters/jdbc/local/LocalManagedConnectionFactory.java?hb=true#to108
> * https://github.com/ironjacamar/ironjacamar/blob/ironjacamar-1.3.4.Final/adapters/src/main/java/org/jboss/jca/adapters/jdbc/local/LocalManagedConnectionFactory.java#L108
> h3. The work-around
> h3. Wildfly 10.1.0.Final Datasource configuration via CLI
> {code}
> # No parameter to set a connection property value.
> {code}
> h3. Wildfly 10.1.0.Final Datasource configuration via XML (standalone-full.xml)
> Note the addition of {{<connection-property name="databaseName">myapp</connection-property>}}
> {code:xml}
> <subsystem xmlns="urn:jboss:domain:datasources:4.0">
> <datasources>
> <datasource jndi-name="java:/MY_APP_DS" pool-name="Postgres_MY_APP_DS">
> <connection-url>jdbc:postgresql://localhost:5432/myapp</connection-url>
> <connection-property name="databaseName">myapp</connection-property>
> <driver>postgres</driver>
> <security>
> <user-name>myapp</user-name>
> <password>myapp</password>
> </security>
> <validation>
> <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
> <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
> </validation>
> </datasource>
> <drivers>
> <driver name="postgres" module="org.postgres">
> <driver-class>org.postgresql.Driver</driver-class>
> <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
> <datasource-class>org.postgresql.ds.PGSimpleDataSource</datasource-class>
> </driver>
> </drivers>
> </datasources>
> </subsystem>
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list