JNDI Datasource for MS SQL Config

I'm at a lose as to how to configure and use the tomcat connection pool. Can anyone give me some pointers and help with this. I have read the forums and the help doc that comes with Tomcat but it didnt really help at all. What am i suppose to put into xml files in Tomcat and where are those xml files. How do i use this when its configured. I tried to get a look at some of the threads in the forum that might help me but i couldnt see them. Error thrown. I know i have to use this to access the connection pool.
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("No Context");
DataSource ds = DataSource)ctx.lookup("java:comp/env/jdbc/TestDB");
if (ds != null) {
Connection conn = ds.getConnection();
Is it ok to use this in a class not a servlet?
Thanks
A troubled and confused man

You have to configure these resources both in the <tomcat>/conf/server.xml file and in the web.xml file of your webapp.
Your server.xml entry goes in &ltContext> or <Default-Context> and will look something like:
<Resource name="jdbc/testDB" auth="Container" type="javax.sql.DataSource" description="Connection to fireguard database"></Resource>
<ResourceParams name="jdbc/testDb">
<parameter><name>factory</name><value>org.apache.commons.dbcp.BasicDataSourceFactory</value></parameter>
<parameter><name>username</name><value>db</value></parameter>
     <parameter><name>password</name><value>dingbats</value></parameter>
     <parameter><name>url</name><value>jdbc:postgresql:db</value></parameter>
  <parameter><name>driverClassName</name><value>org.postgresql.Driver</value></parameter></ResourceParams>You need an resource ref entry in your web.xml too:
<resource-ref>
  <res-ref-name>jdcn/testDb</res-ref-name>
  <res-type>javax.sql.DataSource<res-type>
</resource-ref>You can only use this set up in code run under Tomcat, the jndi context only exits inside the Tomcat container.

Similar Messages

  • Cannot create datasource for MS SQL Server

    Hi,
    I'm trying to create a datasource for MS SQL server and I get this error
    Connection test failed.
    Login failed for user 'gdahan'. The user is not associated with a trusted SQL Server connection.
    com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Lcom.microsoft.sqlserver.jdbc.SQLServerConnection;Ljava.lang.Object;Ljava.lang.String;Lcom.microsoft.sqlserver.jdbc.StreamError;Z)V(Unknown Source)
    com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(Lcom.microsoft.sqlserver.jdbc.TDSReader;)V(Unknown Source)
    com.microsoft.sqlserver.jdbc.TDSParser.parse(Lcom.microsoft.sqlserver.jdbc.TDSReader;Lcom.microsoft.sqlserver.jdbc.TDSTokenHandler;)V(Unknown Source)
    com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon
    The database is in "Windows authentication" mode (not "SQL authentication") and I can connect to it through "Toad for MS SQL Server". In this case I don't need to specify any username or password because I'm already logged in as gdahan on my computer. But when I try to create the datasource I need a username and password. Is there any way to specify to the datasource that I want to connect via Authentication windows ?
    I tried with BEA MS SQL server driver and Microsoft SQL Server 2005 JDBC Driver 1.2[                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Guillaume Dahan wrote:
    Hi,
    I'm trying to create a datasource for MS SQL server and I get this error
    Connection test failed.
    Login failed for user 'gdahan'. The user is not associated with a trusted SQL Server connection.
    com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Lcom.microsoft.sqlserver.jdbc.SQLServerConnection;Ljava.lang.Object;Ljava.lang.String;Lcom.microsoft.sqlserver.jdbc.StreamError;Z)V(Unknown Source)
    com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEOF(Lcom.microsoft.sqlserver.jdbc.TDSReader;)V(Unknown Source)
    com.microsoft.sqlserver.jdbc.TDSParser.parse(Lcom.microsoft.sqlserver.jdbc.TDSReader;Lcom.microsoft.sqlserver.jdbc.TDSTokenHandler;)V(Unknown Source)
    com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon
    The database is in "Windows authentication" mode (not "SQL authentication") and I can connect to it through "Toad for MS SQL Server". In this case I don't need to specify any username or password because I'm already logged in as gdahan on my computer. But when I try to create the datasource I need a username and password. Is there any way to specify to the datasource that I want to connect via Authentication windows ?
    I tried with BEA MS SQL server driver and Microsoft SQL Server 2005 JDBC Driver 1.2[See the complete documentation for MS's JDBC driver
    for how/whether it can do Windows Authentication.
    This is completely at the driver level, not WebLogic,
    except that (of course) WebLogic would have to be
    running on Windows.
    Joe

  • How create a jndi / datasource for MySQL?

    Hi. This is CarloSilva, from Brazil, again. This time for help to datasource. My application uses MySQL database and ADF components. Please, would can anybody tell me step to step how to create a jndi conection datasource?
    I need setup project for uses datasource, no jdbc connection. How to?
    I need setup web.xml. How?
    I need setup a datasource in JDeveloper for my application. How?
    Please, sorry this questions but I new in JDeveloper and need use it for learn.
    Thanks.

    A JDBC connection may be used as a JNDI resource.
    If the Connections-Navigator connection is DBConnection1, the corresponding datasource is jdbc/DBConnection1DS.
    1. Create a JSP page.
    2. In the web.xml of the JSP add
    <resource-ref>
    <res-ref-name>jdbc/DBConnection1DS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    3. In the JSP page obtain a connection with the datasource.
    InitialContext initialContext = new InitialContext();
    javax.sql.DataSource ds = (javax.sql.DataSource)initialContext.lookup("java:comp/env/jdbc/DBConnection1DS");
    java.sql.Connection conn = ds.getConnection();

  • Can't add datasource for local SQL Server Express

    I can't get new datasource to connect to a local SQL Server Express (2008).
    On SSE, I enabled non-NTLM authentication, created an account specifically for CFServer, and was able to log into SQL Server through Management Studio. But the datasource still won't connect.
    When I enter computerName/SQLServerName for the Server, I get a message saying "...The requested instance is either invalid or not running."
    When I enter just SQLServerName, message says "Error establishing socket. Unknown host: SQLServerName."
    When I enter (local), I get a message saying "Error establishing socket. Unknown host: (local)"
    When I enter 127.0.0.1, message says "Error establishing socket to host and port: 127.0.0.1:1433. Reason: Connection refused: connect"
    I don't know why the first is considered invalid, or why the fourth is refusing connection. Am I forgetting something?

    I found the solution, which doesn't have to do with Coldfusion, but rather with configuring SQL Server for TCP/IP.  In case someone else ever stumbles upon this post with a similar problem, I wrote about it at http://forums.devshed.com/ms-sql-development-95/trying-to-connect-to-sql-server-on-localho st-1433t-958558.html.

  • Setting up datasource for MS SQL SERVER 2005 Express

    Can anyone offer me a little help
    I have SQL 2005 Express Edition installed on the same machine
    as CF
    I've been into it and enabled TCP/IP and NAMED PIPES
    I've set TCP port to 1433
    I've created a login account called CF and enabled both SQL
    and Windows authentication
    I've created a database called coldfusionDB
    I've set windows firewall to make an exception for that port
    In CF Administrator I'm using the supplied Microsoft SQL
    driver. Can someone tell me what to put in the fields for the
    datasource ? I have the following:
    Port = 1433
    DATABASE = coldfusionDB
    SERVER = DESKTOP\SQLEXPRESS
    the Error I'm getting back from CF Administrator is:
    * Connection verification failed for data source:
    cfclientstore
    java.sql.SQLException: [Macromedia][SQLServer JDBC
    Driver][Macromedia][SQLServer JDBC Driver]The requested instance is
    either invalid or not running.
    The root cause was that: java.sql.SQLException:
    [Macromedia][SQLServer JDBC Driver][Macromedia][SQLServer JDBC
    Driver]The requested instance is either invalid or not running.

    Try:
    Server = localhost\sqlexpress
    Database = coldfusionDB
    Port = 1433
    Also verify that the SQL server service has started.
    These links may also help:
    http://www.adobe.com/go/kb400255
    http://www.mattwoodward.com/blog/index.cfm?event=showEntry&entryID=01930619-FD0A-4F02-31B1 BFC7D1D9A44C

  • CF8 with JBoss JNDI datasource

    After installing and configuring a CF8 for J2EE running on
    JBoss 4.2.2.GA with Java 6, I have created a JNDI datasource for
    Oracle 10g in the oracle-ds.xml file. I have configured a CF8
    datasource that uses the JNDI resource.
    Any query that is NOT using cfqueryparam works quite well.
    As soon as cfqueryparam is used, I get an "Error casting an
    object of type org.jboss.resource.adapter.jdbc.WrappedConnection
    cannot be cast to coldfusion.server.j2ee.sql.JRunConnectionHandle
    to an incompatible type.".
    The configuration and the exception is pretty much the same
    as described in
    Problem
    description.
    This is clearly a CF8 bug and I was wondering if there is any
    known workaround for it.

    In web.xml making the following entry:
    <web-app>
    <description>MySQL Test App</description>
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    Next, add a file jboss-web.xml under WEB-INF/ folder of the web-application. This file should contain entry as:
    <jboss-web>
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <jndi-name>java:/jdbc/test</jndi-name>
    <res-auth>Container</res-auth>
    </resource-ref>
    </jboss-web>
    Next, in JBOSS_HOME/server/default/deploy folder make a xx-ds.xml file or else, a similiar file can be found in that same folder with the name hsqldb-ds.xml. Make following entries in that xml file:
    <datasources>
    <local-tx-datasource>
    <jndi-name>/jdbc/test</jndi-name>
    <type-mapping>MySQL</type-mapping>
    <connection-url>jdbc:mysql://localhost:3306/shopping_cart</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>root</user-name>
    <password>root123</password>
    <min-pool-size>1</min-pool-size>
    <max-pool-size>5</max-pool-size>
    </local-tx-datasource>
    This should bind the jndi name.
    In our client application, we need to look up as:
    Context ctx = new InitialContext();
    DataSource ds = (DataSource)ctx.lookup("java:/jdbc/test");
    Connection conn = ds.getConnection();
    This works perfectly.

  • Format of the JNDI name for lookup in DataSource

    Hi
    a) I have made a datasource in Weblogic 10.3 called SQL and its JNDI name as jdbc/SQLDS.
    The driver was BEA'S Type 4 Driver for MS SQL Server
    Now I am trying to lookup the datasource through an application. I have used the following
    lines of code:
    InitialContext context = new InitialContext();
    DataSource ds = context.lookup("jdbc/SQLDS");
    Connection conn = ds.getConnection();
    The Application was a success.
    I saw in some articles that you can refer to the datasource by even java:comp/env/jdbc/SQLDS,
    instead of just jdbc/SQLDS. I tried both ways and I was able to run the application.
    b) Then I made another datasource in Weblogic 10.3 called SQL1 and its JNDI name as jdbc/SQL1.
    The driver was MS SQL Server Type 4 Driver for versions 2000, 2005
    Now I am trying to lookup the datasource through an application. I have used the following
    lines of code:
    InitialContext context = new InitialContext();
    DataSource ds = context.lookup("jdbc/SQL1");
    Connection conn = ds.getConnection();
    The Application was a success.
    I saw in some articles that you can refer to the datasource by even java:comp/env/jdbc/SQL1,
    instead of just jdbc/SQL1. I tried the first way and it didnt work. It gave me a NullPointerException
    at the line Connection conn = ds.getConnection();
    c)Then I made a 3rd datasource in Weblogic 10.3 called SQL2 and its JNDI name as jdbc/SQL2DS.
    The driver was MS SQL Server Type 4 Driver for versions 2000, 2005
    Now I am trying to lookup the datasource through an application. I have used the following
    lines of code:
    InitialContext context = new InitialContext();
    DataSource ds = context.lookup("jdbc/SQL2DS");
    Connection conn = ds.getConnection();
    The Application was a success.
    I saw in some articles that you can refer to the datasource by even java:comp/env/jdbc/SQL2DS,
    instead of just jdbc/SQL2DS. I tried the first way and it didnt work. Again, it gave me a NullPointerException
    at the line Connection conn = ds.getConnection();
    I was confused why the 2nd and 3rd way didnt work . Is it becaue I used Microsoft's MS SQL Server Type 4 Driver?
    I have added the jar file in the WEBLOGIC_CLASSPATH. Why is it not recognising java:comp/env/jdbc/SQL2DS ?
    I would be grateful if somebody could give me ideas on this...
    Thanks
    Neeti

    To use application scoped or indirect JNDI lookups (i.e. java:comp/env/...) you usually need to define a &lt;resource-ref&gt; entry in your deployment descriptor(s). Not sure what type of application you are using to test (web-app, EJB,) but for java:comp/env/ lookups to work, you need to define resource references. The fact that your first test succeeded is somewhat strange. Without the resource reference definitions, I would have expected your JNDI lookups to fail with a NamingException instead of the lookup returning NULL for the datasource.
    Assuming you are doing your test from a web-app, you need to add &lt;resource-ref&gt; definitions to your web.xml file similar to the following:
    &lt;resource-ref&gt;
    &lt;res-ref-name&gt;*jdbc/SQL2DS*&lt;/res-ref-name&gt;
    &lt;res-type&gt;java.sql.DataSource&lt;/res-type&gt;
    &lt;res-auth&gt;Container&lt;/res-auth&gt;
    &lt;/resource-ref&gt;
    and then add &lt;reference-descriptor&gt; definitions to your weblogic.xml file similar to the following:
    &lt;reference-descriptor&gt;
    &lt;resource-description&gt;
    &lt;res-ref-name&gt;*jdbc/SQL2DS*&lt;/res-ref-name&gt;
    &lt;jndi-name&gt;*jdbc/SQL2DS*&lt;/jndi-name&gt;
    &lt;/resource-description&gt;
    &lt;/reference-descriptor&gt;
    Once you do these steps your lookup("java:comp/env/jdbc/SQL2DS") should function properly from within your web-app.

  • JNDI parameter for sql taglib

    I want to use sql taglibirary that will use jndi datasource. What is teh correct syntax?
    let say my connectionpool name is conpool.
    I tried
    <sql setDataSource dataSource="conpool">
    doesn't work
    I even tried 'jdbc/connpool' and 'java:comp/env/jdbc/conpool' none worked, what is the correct syntax?
    Shailesh

    you have to create a datasource for the connection pool and use the jndi name specified there. java:comp is when you define a resource reference in web.xml

  • JSTL sql tags with jndi datasource

              Im trying to use JSTL sql tags but get "no suitable driver" when trying to connect
              to a jndi datasource. the jakarta dbtags works fine but jstl does not
              

              I figured it out but I'll leave it up to BEA to tell everyone how to doit.
              "Fred Forester" <[email protected]> wrote:
              >
              >
              >Im trying to use JSTL sql tags but get "no suitable driver" when trying
              >to connect
              >to a jndi datasource. the jakarta dbtags works fine but jstl does not
              

  • How do I use a JNDI datasource in my application?

    Not sure how to access the JNDI datasource i setup in my config.xml. I tried to browse it at rmi://localhost:1099/ but it only shows jmxrmi in the tree.
    My config.xml looks like
    <n1:config xsi:schemaLocation="http://www.bea.com/ns/wlevs/config/server wlevs_server_config.xsd" xmlns:n1="http://www.bea.com/ns/wlevs/config/server" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <netio>
        <name>NetIO</name>
        <port>9002</port>
      </netio>
      <work-manager>
        <name>JettyWorkManager</name>
        <min-threads-constraint>5</min-threads-constraint>
        <max-threads-constraint>10</max-threads-constraint>
      </work-manager>
      <jetty>
        <name>JettyServer</name>
        <network-io-name>NetIO</network-io-name>
        <work-manager-name>JettyWorkManager</work-manager-name>
      </jetty>
      <rmi>
        <name>RMI</name>
        <http-service-name>JettyServer</http-service-name>
      </rmi>
      <jndi-context>
        <name>JNDI</name>
      </jndi-context>
      <exported-jndi-context>
        <name>exportedJndi</name>
        <rmi-service-name>RMI</rmi-service-name>
      </exported-jndi-context>
      <jmx>
        <jndi-service-name>JNDI</jndi-service-name>
        <rmi-service-name>RMI</rmi-service-name>
        <rmi-registry-port>1099</rmi-registry-port>
        <rmi-jrmp-port>9999</rmi-jrmp-port>
      </jmx>
      <transaction-manager>
          <name>transactionmanager</name>
          <!--max-resource-requests-on-server>1</max-resource-requests-on-server>
          <max-resource-unavailable-millis>1000</max-resource-unavailable-millis-->
      </transaction-manager>
      <data-source>   
          <name>hqsqlconn</name>   
          <driver-params>     
            <url>jdbc:hsqldb:hsql://localhost/wlevdb</url>
            <driver-name>org.hsqldb.jdbcDriver</driver-name>
            <properties>
              <element>
                <name>user</name>
                <value>sa</value>
              </element>
              <element>
                <name>password</name>
                <value></value>
              </element>
            </properties>
            <use-xa-data-source-interface>true</use-xa-data-source-interface>   
          </driver-params>   
          <connection-pool-params>     
            <initial-capacity>1</initial-capacity>     
            <max-capacity>5</max-capacity>     
            <test-table-name>test_table</test-table-name>   
          </connection-pool-params>   
          <data-source-params>     
            <jndi-names>
              <element>hqsqlconn</element>
            </jndi-names>
            <global-transactions-protocol>TwoPhaseCommit</global-transactions-protocol>
          </data-source-params> 
      </data-source>
    </n1:config>

    I see what you are saying.
    The JNDI approach should work-we will try to reproduce this internally.
    I would recommend leveraging the OSGi service registry, instead of using JNDI, however. The Event Server is a modular server based on OSGi, so one should use the OSGi service registry whenever possible instead of using the jndi registry. Jndi is primarily there to support legacy code that requires Jndi.
    Any data sources that you configure are automatically registered in the OSGi service registry. When there is more than one data source they can be distinguished using their name.
    There are a couple of options.
    If you want to inject a reference to your datasource into a Spring bean, you can use an annotation, @Service, to annotate a setter method on your bean (see my previous post). The container will then inject a reference to the data source into the bean.
    You can also put the following in your spring application context file
    <osgi:reference id="myDataSource"
    interface="javax.sql.DataSource"/>
    This creates a bean proxy that references the datasource by looking up the datasource in the OSGi service registry. It works similarly to JndiObjectFactoryBean, but it uses the OSGi service registry instead of the JNDI registry. You can read more about it here
    http://www.springframework.org/osgi/specification
    (Look in section 3.3)
    Hope that helps.
    Seth
    Edited by swhite at 08/01/2007 6:19 PM

  • Tomcat 5.0.* global JNDI database connect pooling. complex config question

    Ok. I can't get global connection pooling to work in tomcat 5.0.24. (I am running windows xp pro)
    I am using MySQL (installed on the same machine) and I have succesfully worked through the tutorial titled "MySQL DBCP Example" found at http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
    This example does not demonstrate global connection pooling, however. I want to share a single connection pool across all my web applications. I don't want a different connection pool for each webapp.
    So I define the connection pool JDBC resource in the conf/server.xml file under the <GlobalNamingResources> element.
    Here is the entire <GlobalNamingResources> element lifted from conf/server.xml:
    (Please overlook some of the formatting mistakes due to the <code> tag interpreting the xml as java.)
    <!-- Global JNDI resources -->
    <GlobalNamingResources>
        <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
        <Resource name="UserDatabase"
                  auth="Container"
                  type="org.apache.catalina.UserDatabase"
                  description="User database that can be updated and saved">
        </Resource>
        <Resource name="jdbc/MySQL"
                  auth="Container"
                  type="javax.sql.DataSource"/>
        <ResourceParams name="UserDatabase">
            <parameter>
                <name>factory</name>
                <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
            </parameter>
            <parameter>
                <name>pathname</name>
                <value>conf/tomcat-users.xml</value>
            </parameter>
        </ResourceParams>
        <ResourceParams name="jdbc/MySQL">
            <parameter>
                <name>factory</name>
                <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
            </parameter>
            <parameter>
                <name>maxActive</name>
                <value>100</value>
            </parameter>
            <parameter>
                <name>maxIdle</name>
                <value>30</value>
            </parameter>
            <parameter>
                <name>maxWait</name>
                <value>20000</value>
            </parameter>
            <parameter>
               <name>username</name>
               <value>webapp</value>
            </parameter>
            <parameter>
               <name>password</name>
               <value>******</value>
            </parameter>
            <parameter>
                <name>removeAbandoned</name>
                <value>true</value>
            </parameter>
            <parameter>
                <name>removeAbandonedTimeout</name>
                <value>3000</value>
            </parameter>
            <parameter>
                <name>logAbandoned</name>
                <value>true</value>
            </parameter>
            <parameter>
                <name>url</name>
                <value>jdbc:mysql://localhost:3306/javatest?autoReconnect=true</value>
            </parameter>
        </ResourceParams>
      </GlobalNamingResources>I am still trying to get the DBTest example (described in the link to the tomcat 5 docs above) to work, only now I want it to work using a global connection pool. So here is the contents of webapps/DBTest/WEB-INF/web.xml: (again, please overlook formatting difficulties :)
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
             http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
             version="2.4">
      <description>MySQL Test App</description>
      <resource-ref>
          <description>DB Connection</description>
          <res-ref-name>jdbc/MySQL</res-ref-name>
          <res-type>javax.sql.DataSource</res-type>
          <res-auth>Container</res-auth>
      </resource-ref>
    </web-app>The last thing I need to do, I think, is to include a <resourceLink> element in the context.xml file for this webapp. Now in tomcat 5.0.* it is not recommended that the <context> element appear in the conf/server.xml file. Instead, as I understand it, it should appear in either of the two following places (for a webapp called DBTest):
    $CATALINA_HOME/conf/[engine_name]/[host_name]/DBTest.xml
    $CATALINA_HOME/webapps/DBTest/META-INF/context.xmlSince I would eventually like to package each webapp in its own war file, I prefer the second option above. This will enable me to place the context.xml file within the .war file. Currently, however, I am not using .war files.
    For the DBTest webapp I have the following <context> element in webapps/DBTest/META-INF/context.xml:
    <context path="/DBTest" docBase="/DBTest" debug="1">
        <ResourceLink global="jdbc/MySQL" name="jdbc/MySQL" type="javax.sql.DataSource" />
    </context>Now, when I point my browser to http://localhost:8080/DBTest/test.jsp I get the following message:
    javax.servlet.ServletException: Unable to get connection, DataSource invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: No suitable driver"
    For those who are interested, here is test.jsp:
    <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <sql:query var="rs" dataSource="jdbc/MySQL">
    select id, foo, bar from javatest.testdata
    </sql:query>
    <html>
      <head>
        <title>DB Test</title>
      </head>
      <body>
      <h2>Results</h2>
    <c:forEach var="row" items="${rs.rows}">
        Foo ${row.foo}<br/>
        Bar ${row.bar}<br/>
    </c:forEach>
      </body>
    </html>Now I know that this is a very long and detailed question and that it is unlikely that anyone is even going to read down this far, let alone take the time to study all that XML, but if anyone is able to tell me why this setup does not allow global connection pooling, I will be pretty *@&$**% impressed. I only wish I had duke dollars to give.
    Jon

    Okay, I went back and double checked that I can get the DBTest example working. It is described here: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html
    I was not able to get it working exactly according to the tutorial, though. I was required to put the <context> element not in the conf/server.xml but in conf/Catalina/localhost/DBTest.xml. Then, with the DBTest/WEB-INF/web.xml as above, I was able to get the DBTest example working. The output of test.jsp (described above also) is the following:
    Results
    Foo hello
    Bar 12345I would like to be able to put the <context> element in webapps/DBTest/META-INF/context.xml (as I think should be allowed) because then I would be able to include it in a war file that encompassed the entire web application. If I am forced to put the <context> element in a subdirectory of the conf directory, then I cannot include it in a war file and I will be unable to just drop my war files in the webapps directory and go. Instead I will have to drop my war files in the webapps directory, then go and fiddle around with the xml files in conf/Catalina/localhost/
    But if I move the <context> element into webapps/DBTest/META-INF/context.xml then the example stops working. When I put it back in conf/Catalina/localhost/DBTest.xml everything is fine again.
    Ok, no big deal. I guess my war file deployment will just have to be a little more complicated.
    But what if I want the resource to be global??? If I remove the <Resource> and <ResourceParams> elements from the webapp-specific <context> element and put them in the <GlobalNamingResource> element in the conf/server.xml file I should have a global resource, right? I did this, then added a resource link to the <context> element (see above), however, the example stops working. I have tried both with and without the <resource-ref> element in web.xml.
    Can some remarkably intelligent and knowledgeable person please explain to me how global resources work in tomcat 5.0, especially global JDBC connection pooling.
    Thanks,
    Jon

  • JBOSS jndi Datasource: jdbc not bound

    Im adding an jndi Datasource to JBOSS 4.0.2.
    1. i copied jdbc driver to JBOSS_HOME/server/default/lib.
    2. i copied following ds.xml to JBOSS_HOME/server/default/deploy (its based ony the mysql-ds.xml from the samples)
    <?xml version="1.0" encoding="UTF-8"?>
    <datasources>
      <local-tx-datasource>
        <jndi-name>jndi-name</jndi-name>
        <connection-url>jdbc:mysql://localhost:3306/databasename</connection-url>
        <driver-class>org.gjt.mm.mysql.Driver</driver-class>
        <user-name>username</user-name>
        <password>password</password>
        <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
        <!-- sql to call when connection is created
        <new-connection-sql>some arbitrary sql</new-connection-sql>
          -->
        <!-- sql to call on an existing pooled connection when it is obtained from pool
        <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
          -->
        <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
        <metadata>
           <type-mapping>mySQL</type-mapping>
        </metadata>
      </local-tx-datasource>
    </datasources>I look this up using java:jndi-name. Works perfect.
    For compatibility with other containers, i want to move my jndi-datasource to java:comp/env/jdbc/jndi-name
    So i change my ds-description:
    <?xml version="1.0" encoding="UTF-8"?>
    <datasources>
      <local-tx-datasource>
        <jndi-name>comp/env/jdbc/jndi-name</jndi-name>
        <connection-url>jdbc:mysql://localhost:3306/databasename</connection-url>
        <driver-class>org.gjt.mm.mysql.Driver</driver-class>
        <user-name>username</user-name>
        <password>password</password>
        <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
        <!-- sql to call when connection is created
        <new-connection-sql>some arbitrary sql</new-connection-sql>
          -->
        <!-- sql to call on an existing pooled connection when it is obtained from pool
        <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
          -->
        <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
        <metadata>
           <type-mapping>mySQL</type-mapping>
        </metadata>
      </local-tx-datasource>
    </datasources>Looking this up with java:comp/env/jdbc/jndi-name leads to Could not find datasource: java:comp/env/jdbc/jndi-name
    javax.naming.NameNotFoundException: jdbc not bound
    Some lines above jboss prints:
    [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:name=comp/env/jdbc/jndi-name,service=DataSourceBinding to JNDI name 'java:comp/env/jdbc/jndi-name
    Please can somebody explain what the problem is about binding a datasource somewhere else than directly to "java:"

    In web.xml making the following entry:
    <web-app>
    <description>MySQL Test App</description>
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    </web-app>
    Next, add a file jboss-web.xml under WEB-INF/ folder of the web-application. This file should contain entry as:
    <jboss-web>
    <resource-ref>
    <description>DB Connection</description>
    <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <jndi-name>java:/jdbc/test</jndi-name>
    <res-auth>Container</res-auth>
    </resource-ref>
    </jboss-web>
    Next, in JBOSS_HOME/server/default/deploy folder make a xx-ds.xml file or else, a similiar file can be found in that same folder with the name hsqldb-ds.xml. Make following entries in that xml file:
    <datasources>
    <local-tx-datasource>
    <jndi-name>/jdbc/test</jndi-name>
    <type-mapping>MySQL</type-mapping>
    <connection-url>jdbc:mysql://localhost:3306/shopping_cart</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>root</user-name>
    <password>root123</password>
    <min-pool-size>1</min-pool-size>
    <max-pool-size>5</max-pool-size>
    </local-tx-datasource>
    This should bind the jndi name.
    In our client application, we need to look up as:
    Context ctx = new InitialContext();
    DataSource ds = (DataSource)ctx.lookup("java:/jdbc/test");
    Connection conn = ds.getConnection();
    This works perfectly.

  • Need Help in JNDI Datasource using tomcat and spring

    Hi,
    I am trying to connect my local database using JNDI datasource in tomcat and spring
    I have done the below configuration in Tomcat 7 server:
    In tomcat server.xml (Path: E:\apache-tomcat-7.0.35\conf) I added the below configuration
    <Resource name="UserDatabase" auth="Container"
    type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved"
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
    pathname="conf/tomcat-users.xml" />
    <Resource name="jdbc/myApp" auth="Container"
    type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.OracleDriver"
    url="jdbc:oracle:thin:hr@localhost:1521:XE>"
    username="testUser" password="password"
    maxActive="10" maxIdle="5"
    maxWait="60000" removeAbandoned="true"
    removeAbandonedTimeout="60" logAbandoned="true"/>
    In web.xml, I have added the below config:
    <resource-ref>
    <description>Oracle Spring JNDI Datasource</description>
    <res-ref-name>jdbc/myApp</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    And in my Spring context xml (ws-context.xml), added below config:
    <bean name="myDataSourceInJndi" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/jdbc/myApp"/>
    </bean>
    <jee:jndi-lookup id="dataSource" jndi-name="/jdbc/myApp" resource-ref="true"/>
    In my Java code, I am trying the below code to connect DataBase:
    Context initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");
    DataSource ds = (DataSource) envCtx.lookup("jdbc/myApp");
    ds.getConnection();
    But I am getting the below exception while executing ****ds.getConnection();***
    java.lang.IllegalStateException: Connection factory returned null from createConnection
    at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:584)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at com.wipro.spring.impl.EmployeeImpl.getDetails(EmployeeImpl.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
    at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
    at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
    at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
    at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
    at com.sun.xml.ws.transport.http.servlet.WSSpringServlet.doPost(WSSpringServlet.java:52)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Can you please me to resolve this issue? Am I missing any configuration or any mistake in my java code please suggest your suggestions.
    Thanks

    Hi,
    I am trying to connect my local database using JNDI datasource in tomcat and spring
    I have done the below configuration in Tomcat 7 server:
    In tomcat server.xml (Path: E:\apache-tomcat-7.0.35\conf) I added the below configuration
    <Resource name="UserDatabase" auth="Container"
    type="org.apache.catalina.UserDatabase"
    description="User database that can be updated and saved"
    factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
    pathname="conf/tomcat-users.xml" />
    <Resource name="jdbc/myApp" auth="Container"
    type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.OracleDriver"
    url="jdbc:oracle:thin:hr@localhost:1521:XE>"
    username="testUser" password="password"
    maxActive="10" maxIdle="5"
    maxWait="60000" removeAbandoned="true"
    removeAbandonedTimeout="60" logAbandoned="true"/>
    In web.xml, I have added the below config:
    <resource-ref>
    <description>Oracle Spring JNDI Datasource</description>
    <res-ref-name>jdbc/myApp</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    And in my Spring context xml (ws-context.xml), added below config:
    <bean name="myDataSourceInJndi" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/jdbc/myApp"/>
    </bean>
    <jee:jndi-lookup id="dataSource" jndi-name="/jdbc/myApp" resource-ref="true"/>
    In my Java code, I am trying the below code to connect DataBase:
    Context initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");
    DataSource ds = (DataSource) envCtx.lookup("jdbc/myApp");
    ds.getConnection();
    But I am getting the below exception while executing ****ds.getConnection();***
    java.lang.IllegalStateException: Connection factory returned null from createConnection
    at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:584)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1388)
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)
    at com.wipro.spring.impl.EmployeeImpl.getDetails(EmployeeImpl.java:57)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)
    at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)
    at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)
    at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)
    at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)
    at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)
    at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)
    at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)
    at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)
    at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:471)
    at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)
    at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)
    at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)
    at com.sun.xml.ws.transport.http.servlet.WSSpringServlet.doPost(WSSpringServlet.java:52)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
    at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1822)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    Can you please me to resolve this issue? Am I missing any configuration or any mistake in my java code please suggest your suggestions.
    Thanks

  • Problem using DataSource for JDBC applications

    import javax.sql.*;
    import java.sql.*;
    import java.io.*;
    import java.text.*;
    import javax.naming.*;
    public class CreateMovieTables {
         //static String driver="COM.cloudscape.core.JDBCDriver";
         //static String url="jdbc:cloudscape:";
         String leadActor,title,leadActress,type,dateOfRelease;
         Connection connection;
         Statement statement;
         DataSource dataSource;
         public void initialize() throws SQLException,NamingException{
              //Class.forName(driver);
              Context initialContext = new InitialContext();
              //connection = DriverManager.getConnection(url + "Movies;create=true");
              dataSource = (DataSource) initialContext.lookup("jdbc/Cloudscape");
              connection = dataSource.getConnection();
    the code goes on
    when i start the j2ee sdk server, the cloudscape server the message i get when i run the program is...
    No local string for datasource.wrongclient
    java.sql.SQLException:
    at com.sun.enterprise.resource.JdbcDataSource.getConnection(JdbcDataSource.java:40)
    at CreateMovieTables.initialize(CreateMovieTables.java:23)
    at CreateMovieTables.main(CreateMovieTables.java:86)
    can anyone please suggest as to where i may be going wrong
    thanx
    -NDK

    I don't agree that a User or System DSN is needed - that's a Windows idiom.
    I haven't used the J2EE SDK to set up a data source, but I know that when I do it in Tomcat I've got to put a <resource-ref> tag in the web.xml that identifies the JNDI lookup string, and then the JDBC driver/URL/username/password details under a <Resource> tag in the context.xml to tell the data source how to create the JDBC connection.
    My <resource-ref> name is "jdbc/APIPrototype". My JNDI lookup string looks like "java:comp/env/jdbc/DataSourceName".
    You've got to do more than just put the JNDI lookup string in the Context lookup. Your error message sounds like the server is saying you've haven't done that set-up work.
    Just a guess - perhaps it's something else, but I couldn't tell from your note. - MOD

  • Specify JNDI Name For EJB Module

    Hi folks, please I need to know how I can specify the Jndi name for an ejb module I am creating in netbeans 5.0, to be accessed by a web application.
    If this can be done using the sun java system application server 9 admin consle (just as for JDBC Resources), i'll also like to know how.
    Thanks.

    Thanks Jay. I went through the links, it seems that if you have the JNDI name set in the weblogic-ejb-jar.xml, there is no need to set the same in the weblogic admin console. I am using ejb 2.x version. Particularly if you get the WLInitialContextFactory in your code , then there is no need to set the JNDI name in the JNDI tree in weblogic admin console.
    Like:-
    Context ctx = null;
    java.sql.Connection conn = null;
    Hashtable<String,String> ht = new Hashtable<String,String>();
    ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    ht.put(Context.PROVIDER_URL,"t3://localhost:7001");
    This will take care of JNDI tree, hence there is no need to set the JNDI name explictly in the weblogic admin console.
    Please correct me if i am wrong. Whether for datasource also whether we can do the same, by setting the resource-ref with datasource in the ejb-jar.xml and not set anything in weblogic admin console? Thanks.

Maybe you are looking for

  • New Macbook Pro (Late 2013) Continuously Loses Internet Connection

    My new macbook pro is constantly losing internet connection.  I have already: 1) Replaced my home modem and router (just in case) 2) Troubleshot the home internet with ISP - they say it is not on their end. 3) Run through a million resets of the home

  • Clip to Clipboard

    I have created a PDF file with password protection. The Clip to Clipboard is grayed out but I can highlight it and copy it. Why? I am viewing the file in Adobe Reader 9.1.3

  • Performance of workspace manager

    I have created versioned tables in Oracle 9.2. It sits in DEC Unix OS. I have experienced performance degredation after versioning the tables. The largest table has about 20 million rows. Do I need to analyze the base table generated by versioning th

  • Error in creating work repository in Postgres

    Hi ... I was trying to create a work repository in Postgres and my test connection was successful. However, when I hit the <ok> button I encountered this error. ERROR: you can only create unique index on the distribution column(s). Thanks in advance

  • Installing 6.1sp2 on Linux

    I just tried to install 6.1sp2 on Linux and install deadlocked after displaying the splash screen. Was it supposed to happen? "Thread-3" daemon prio=1 tid=0x0x81e8e38 nid=0x194b waiting on monitor [51280000..5128086c]      at java.lang.Object.wait(Na