How to create a datasource from the JBoss CLI in JBoss EAP 6 and 7

Solution Verified - Updated -

Issue

  • How to create datasources using the command line interface ?
  • On creating a datasource using cli commands, when trying to specify "pool-name" attribute, the operation fails.
  • How to change the datasource password using CLI script ?
  • How to create datasources in Domain mode using CLI?
  • Unable to create the module for the driver using the JBoss CLI command in EAP 6 domain mode. Facing the below error:
    [domain@127.0.0.1:9999 /] module add --name=com.oracle.jdbc --resources=/path/to/ojdbc6.jar --dependencies=javax.api,javax.transaction.api
    The command is not available in the current context (e.g. required subsystems or connection to the controller might be unavailable).
  • tried with giving the properties name as "URL", but getting error.
[/] /subsystem=datasources/xa-data-source=<pool>:add(jndi-name="name",connection-url="url",
...
'connection-url' is not found among the supported properties: [prepared-statements-cache-size, spy, password, recovery-password, wrap-xa-resource, max-pool-size, set-tx-query-timeout, jndi-name, url-delimiter, enabled, same-rm-override, blocking-timeout-wait-millis, statistics-enabled, pool-use-strict-min, validate-on-match, transaction-isolation, valid-connection-checker-class-name, no-recovery, allocation-retry-wait-millis, exception-sorter-properties, background-validation-millis, track-statements, no-tx-separate-pool, use-fast-fail, recovery-security-domain, flush-strategy, stale-connection-checker-class-name, exception-sorter-class-name, interleaving, check-valid-connection-sql, reauth-plugin-class-name, allow-multiple-users, url-selector-strategy-class-name, user-name, background-validation, use-ccm, recovery-plugin-class-name, reauth-plugin-properties, driver-name, stale-connection-checker-properties, query-timeout, idle-timeout-minutes, xa-datasource-class, recovery-plugin-properties, use-java-context, valid-connection-checker-properties, min-pool-size, allocation-retry, security-domain, new-connection-sql, xa-resource-timeout, recovery-username, pad-xid, pool-prefill, use-try-lock, share-prepared-statements]

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.x
    • 7.x
  • datasource and xa-datasource as defined in
    • jboss-as-datasources_1_1.xsd
    • jboss-as-datasources_1_2.xsd

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.