Basic JNDI Connection

SQLUnit can also lookup a DataSource object from a JNDI server, and get the database Connection object from that. You will need to specify the data source name to lookup, and the JNDI arguments. Refer to the documentation for your JNDI server to determine what the JNDI arguments should be. Here is an example of setting up a Mock JNDI server that SQLUnit uses for its tests.


<connection connection-id="2">
  <datasource>jdbc/mockDSN</datasource>
  <jndi>
    <arg name="java.naming.factory.initial"
        value="net.sourceforge.sqlunit.test.mock.MockInitialContextFactory" />
  </jndi>
</connection>