[
https://issues.jboss.org/browse/WFLY-7018?page=com.atlassian.jira.plugin....
]
Lin Gao commented on WFLY-7018:
-------------------------------
When {{connection-url}} is defined, and the {{datasource-class}} is *NOT* defined either
in {{driver}} or in {{data-source}} element, IronJacamar uses
[java.sql.DriverManager.getConnection(String url, String username, String
password)|https://docs.oracle.com/javase/8/docs/api/java/sql/DriverManage...]
to get the database connection by using the specified {{connection-url}}.
When {{datasource-class}} is defined either in {{driver}} or in {{data-source}} element,
IronJacamar uses DataSource to get the database connection, which is the [preferred
way|https://docs.oracle.com/javase/tutorial/jdbc/basics/connecting.html].
A set of connection property needs to be defined to connect database via
[
DataSource|https://docs.oracle.com/javase/8/docs/api/javax/sql/DataSource...]. In case
of PostgreSQL server, I think you can specify:
{code:xml}
<connection-property
name="url">jdbc:postgresql://localhost:5432/myapp</connection-property>
{code}
instead of defining the {{<connection-url>}} in your configuration.
If you still want to use the {{connection-url}} configuration, remove the
{{datasource-class}} definition in {{driver}} element can also be fine, but it is not
recommended.
With WFCORE-1362 resolved, the command:
{code:java}
data-source add
--connection-properties={"url"=>"myurl","user"=>"user","pass"=>"pass"}
{code}
supports specifying the {{connection-properties}} in one go when adding a new
data-source.
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/jb...
*
https://github.com/ironjacamar/ironjacamar/blob/ironjacamar-1.3.4.Final/a...
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)