{"id":1251,"date":"2016-03-26T08:59:08","date_gmt":"2016-03-26T12:59:08","guid":{"rendered":"http:\/\/shirishranjit.com\/blog1\/?page_id=1251"},"modified":"2016-03-26T09:00:49","modified_gmt":"2016-03-26T13:00:49","slug":"setting-up-data-source-in-wildfly","status":"publish","type":"page","link":"https:\/\/shirishranjit.com\/blog1\/technical-posts\/jboss-wildfly\/setting-up-data-source-in-wildfly","title":{"rendered":"Setting up Data source in Wildfly"},"content":{"rendered":"<p>\/bin\/jbosscli.sh<\/p>\n<p>Add postgres library<\/p>\n<p>module add &#8211;name=org.postgres &#8211;resources=\/home\/inventory\/postgresql-9.4-1206-jdbc41.jar &#8211;dependencies=javax.api,javax.transaction.api <\/p>\n<p>add subsystem.<\/p>\n<p>\/subsystem=datasources\/jdbc-driver=postgres:add(driver-name=&#8221;postgres&#8221;,driver-module-name=&#8221;org.postgres&#8221;,driver-class-name=org.postgresql.Driver)<\/p>\n<p>\/subsystem=datasources:installed-drivers-list<\/p>\n<p>\/subsystem=datasources\/jdbc-driver=postgres:add(driver-name=&#8221;postgres&#8221;,driver-module-name=&#8221;org.postgres&#8221;,driver-class-name=org.postgresql.Driver)<\/p>\n<p>data-source add \\<br \/>\n    &#8211;name=mydatabaseDS \\<br \/>\n    &#8211;jndi-name=java:\/mydatabaseDS \\<br \/>\n    &#8211;use-java-context=true \\<br \/>\n    &#8211;use-ccm=true \\<br \/>\n    &#8211;connection-url=jdbc:postgresql:\/\/${postgresql.db.host}:${postgresql.db.port}\/${postgresql.db.name} \\<br \/>\n    &#8211;driver-name=postgresql \\<br \/>\n    &#8211;user-name=${postgresql.db.username} \\<br \/>\n    &#8211;password=${postgresql.db.password} \\<br \/>\n    &#8211;check-valid-connection-sql=&#8221;SELECT 1&#8243; \\<br \/>\n    &#8211;background-validation=true \\<br \/>\n    &#8211;background-validation-millis=60000 \\<br \/>\n    &#8211;flush-strategy=IdleConnections \\<br \/>\n    &#8211;min-pool-size=10 \\<br \/>\n    &#8211;max-pool-size=50 \\<br \/>\n    \u2014pool-prefill=false<\/p>\n<p>data-source add \\<br \/>\n    &#8211;name=inventoryDS \\<br \/>\n    &#8211;jndi-name=java:\/inventoryDS \\<br \/>\n    &#8211;use-java-context=true \\<br \/>\n    &#8211;use-ccm=true \\<br \/>\n    &#8211;connection-url=jdbc:postgresql:\/\/localhost\/postgres \\<br \/>\n    &#8211;driver-name=postgres \\<br \/>\n    &#8211;user-name=postgres \\<br \/>\n    &#8211;password=123456 \\<br \/>\n    &#8211;check-valid-connection-sql=&#8221;SELECT 1&#8243; \\<br \/>\n    &#8211;background-validation=true \\<br \/>\n    &#8211;background-validation-millis=60000 \\<br \/>\n    &#8211;flush-strategy=IdleConnections \\<br \/>\n    &#8211;min-pool-size=10 \\<br \/>\n    &#8211;max-pool-size=50 \\<br \/>\n    \u2014pool-prefill=false<\/p>\n<h2>References<\/h2>\n<ol>\n<li> https:\/\/docs.jboss.org\/author\/display\/WFLY10\/Security+Realms<\/li>\n<\/ol>\n<div class=\"twttr_buttons\"><div class=\"twttr_twitter\">\n\t\t\t\t\t<a href=\"http:\/\/twitter.com\/share?text=Setting+up+Data+source+in+Wildfly\" class=\"twitter-share-button\" data-via=\"\" data-hashtags=\"\"  data-size=\"default\" data-url=\"https:\/\/shirishranjit.com\/blog1\/technical-posts\/jboss-wildfly\/setting-up-data-source-in-wildfly\"  data-related=\"\" target=\"_blank\">Tweet<\/a>\n\t\t\t\t<\/div><div class=\"twttr_followme\">\n\t\t\t\t\t\t<a href=\"https:\/\/twitter.com\/shiranjit\" class=\"twitter-follow-button\" data-size=\"default\"  data-show-screen-name=\"false\"  target=\"_blank\">Follow me<\/a>\n\t\t\t\t\t<\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>\/bin\/jbosscli.sh Add postgres library module add &#8211;name=org.postgres &#8211;resources=\/home\/inventory\/postgresql-9.4-1206-jdbc41.jar &#8211;dependencies=javax.api,javax.transaction.api add subsystem. \/subsystem=datasources\/jdbc-driver=postgres:add(driver-name=&#8221;postgres&#8221;,driver-module-name=&#8221;org.postgres&#8221;,driver-class-name=org.postgresql.Driver) \/subsystem=datasources:installed-drivers-list \/subsystem=datasources\/jdbc-driver=postgres:add(driver-name=&#8221;postgres&#8221;,driver-module-name=&#8221;org.postgres&#8221;,driver-class-name=org.postgresql.Driver) data-source add \\ &#8211;name=mydatabaseDS \\ &#8211;jndi-name=java:\/mydatabaseDS \\ &#8211;use-java-context=true \\ &#8211;use-ccm=true \\ &#8211;connection-url=jdbc:postgresql:\/\/${postgresql.db.host}:${postgresql.db.port}\/${postgresql.db.name} \\ &#8211;driver-name=postgresql \\ &#8211;user-name=${postgresql.db.username} \\ &#8211;password=${postgresql.db.password} \\ &#8211;check-valid-connection-sql=&#8221;SELECT 1&#8243; \\ &#8211;background-validation=true \\ &#8211;background-validation-millis=60000 \\ &hellip; <a href=\"https:\/\/shirishranjit.com\/blog1\/technical-posts\/jboss-wildfly\/setting-up-data-source-in-wildfly\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":4,"featured_media":0,"parent":336,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-1251","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/pages\/1251"}],"collection":[{"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/comments?post=1251"}],"version-history":[{"count":2,"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/pages\/1251\/revisions"}],"predecessor-version":[{"id":1253,"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/pages\/1251\/revisions\/1253"}],"up":[{"embeddable":true,"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/pages\/336"}],"wp:attachment":[{"href":"https:\/\/shirishranjit.com\/blog1\/wp-json\/wp\/v2\/media?parent=1251"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}