<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    javax.naming.NameNotFoundException: jdbc not bound
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/smithakutty">Smitha K</a> in <i>Beginner's Corner</i> - <a href="https://community.jboss.org/message/780560#780560">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I have the following deployment details:-( I am trying to connect to the&#160; database,but getting error)</p><p>1)ejb-jar.xml:-</p><p>&lt;?xml version="1.0"?&gt;<br/>&lt;!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"<br/>"<a class="jive-link-external-small" href="http://java.sun.com/dtd/ejb-jar_2_0.dtd">http://java.sun.com/dtd/ejb-jar_2_0.dtd</a>"&gt;<br/>&lt;ejb-jar&gt;<br/>&#160; &lt;description&gt;A simple session bean&lt;/description&gt;<br/>&#160; &lt;display-name&gt;Simple Message EJB&lt;/display-name&gt;<br/>&#160; &lt;enterprise-beans&gt;<br/>&#160;&#160;&#160;&#160; &lt;session&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;ejb-name&gt;FirstEJBBean&lt;/ejb-name&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;home&gt;FirstEJBHome&lt;/home&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;remote&gt;FirstEJBObject&lt;/remote&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;local-home&gt;FirstLocalEJBHome&lt;/local-home&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;local&gt;FirstLocalEJBObject&lt;/local&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;ejb-class&gt;FirstEJBBean&lt;/ejb-class&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;session-type&gt;Stateless&lt;/session-type&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;transaction-type&gt;Container&lt;/transaction-type&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;env-entry&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;description&gt; Maximum percentage discount for a customer &lt;/description&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;env-entry-name&gt; maxCustomerDiscount &lt;/env-entry-name&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;env-entry-type&gt; java.lang.Double &lt;/env-entry-type&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;env-entry-value&gt; 50 &lt;/env-entry-value&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;/env-entry&gt;<br/>&#160;&#160;&#160;&#160; &lt;ejb-ref&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ejb-ref-name&gt;ejb/FirstEJBBeanRemoteTest&lt;/ejb-ref-name&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ejb-ref-type&gt;Session&lt;/ejb-ref-type&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;home&gt;FirstEJBHome&lt;/home&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;remote&gt;FirstEJBObject&lt;/remote&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ejb-link&gt;FirstEJBBean&lt;/ejb-link&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;/ejb-ref&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;ejb-local-ref&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ejb-ref-name&gt;ejb/FirstEJBBeanTest&lt;/ejb-ref-name&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ejb-ref-type&gt;Session&lt;/ejb-ref-type&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;local-home&gt;FirstLocalEJBHome&lt;/local-home&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;local&gt;FirstLocalEJBObject&lt;/local&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;ejb-link&gt;FirstEJBBean&lt;/ejb-link&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;/ejb-local-ref&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160; &lt;resource-ref&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;res-ref-name&gt;jdbc/nbuDS&lt;/res-ref-name&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;res-auth&gt;Container&lt;/res-auth&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;/resource-ref&gt;<br/>&#160;&#160;&#160; &lt;/session&gt;<br/>&lt;/enterprise-beans&gt;<br/>&lt;/ejb-jar&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>2)jboss-xml</p><p class="jive-thread-reply-message"><div class="jive-rendered-content"><div class="mcePaste"></div></div></p><p>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt;<br/>&lt;jboss&gt;<br/>&#160; &lt;enterprise-beans&gt;<br/>&#160;&#160;&#160;&#160; &lt;session&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;ejb-name&gt;FirstEJBBean&lt;/ejb-name&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;resource-ref&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;res-ref-name&gt;jdbc/nbuDS&lt;/res-ref-name&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;jndi-name&gt;jbossDS&lt;/jndi-name&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160; &lt;/resource-ref&gt;<br/>&#160;&#160;&#160;&#160;&#160; &lt;jndi-name&gt;ejb/FirstEJBBeanRemote&lt;/jndi-name&gt;<br/>&#160;&#160; &lt;/session&gt;<br/>&#160; &lt;/enterprise-beans&gt;<br/>&lt;/jboss&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>My Local bean code is:-</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>ejbCtx = (Context) context.lookup("java:comp/env");</p><p>dsrc = (DataSource)ejbCtx.lookup("jdbc/nbuDS");</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have jboss-ds file in the&#160; default/deply folder configured as&#160; follows:-</p><p>&lt;?xml version="1.0" encoding="UTF-8"?&gt;<br/>&lt;datasources&gt;<br/>&#160;&#160;&#160; &lt;local-tx-datasource&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;jndi-name&gt;jbossDS&lt;/jndi-name&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;connection-url&gt;jdbc:sqlserver://172.16.84.66:1433;sendStringParametersAsUnicode=false;databaseName=NBU&lt;/connection-url&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;driver-class&gt;com.microsoft.sqlserver.jdbc.SQLServerDriver&lt;/driver-class&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;min-pool-size&gt;5&lt;/min-pool-size&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;max-pool-size&gt;30&lt;/max-pool-size&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;track-statements&gt;true&lt;/track-statements&gt;<br/>&#160; &lt;prepared-statement-cache-size&gt;10&lt;/prepared-statement-cache-size&gt;<br/>&#160; &lt;query-timeout&gt;60&lt;/query-timeout&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;user-name&gt;sa&lt;/user-name&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;password&gt;M8$tek12&lt;/password&gt;<br/>&lt;/local-tx-datasource&gt;<br/>&lt;/datasources&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>But i am still unable to connect to database.</p><p>Please provide me&#160; inputs for the same.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/780560#780560">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Beginner's Corner at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>