Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>first create an xml file by name <strong><code>xxx-ds.xml</code></strong> and place this file in <code>server/default/deploy/xxx-ds.xml</code></p> <pre class="lang-xml prettyprint-override"><code>&lt;datasources&gt; &lt;local-tx-datasource&gt; &lt;jndi-name&gt;/jdbc/Exp&lt;/jndi-name&gt; &lt;type-mapping&gt;SQL&lt;/type-mapping&gt; &lt;connection-url&gt;jdbc:microsoft:sqlserver:// &lt;/connection-url&gt; &lt;driver-class&gt;com.microsoft.jdbc.sqlserver.SQLServerDriver&lt;/driver-class&gt; &lt;user-name&gt;&lt;/user-name&gt; &lt;password&gt;&lt;/password&gt; &lt;min-pool-size&gt;5&lt;/min-pool-size&gt; &lt;max-pool-size&gt;1000&lt;/max-pool-size&gt; &lt;/local-tx-datasource&gt; &lt;/datasources&gt; </code></pre> <p><strong><code>jboss-web.xml</code></strong></p> <pre class="lang-xml prettyprint-override"><code>&lt;jboss-web&gt; &lt;!-- &lt;security-domain flushOnSessionInvalidation="false"/&gt;--&gt; &lt;!-- &lt;context-root&gt;/BSI&lt;/context-root&gt;--&gt; &lt;resource-ref&gt; &lt;description&gt;Database connection resource&lt;/description&gt; &lt;res-ref-name&gt;jdbc/Exp&lt;/res-ref-name&gt; &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt; &lt;jndi-name&gt;java:/jdbc/Exp&lt;/jndi-name&gt; &lt;res-auth&gt;Container&lt;/res-auth&gt; &lt;/resource-ref&gt; &lt;/jboss-web&gt; </code></pre> <p><strong><code>web.xml</code></strong></p> <pre class="lang-xml prettyprint-override"><code>&lt;resource-ref&gt; &lt;description&gt;Database connection resource&lt;/description&gt; &lt;res-ref-name&gt;jdbc/Exp&lt;/res-ref-name&gt; &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt; &lt;res-auth&gt;Container&lt;/res-auth&gt; &lt;/resource-ref&gt; </code></pre> <p>and now in your <code>.java</code> file</p> <pre class="lang-java prettyprint-override"><code>javax.naming.Context ctx1 = new javax.naming.InitialContext(); javax.sql.DataSource ds = (javax.sql.DataSource) ctx1.lookup("java:comp/env/jdbc/Exp"); con = ds.getConnection(); </code></pre> <p>***** make sure that resource ref name should be same in all place</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload