Gary, I'm running 1.3.8.

Per your research into the Orion JNDI namespace, could there be an
undocumented quirk in Orion's implementation?  I've been using JNDI/LDAP
pretty extensively the last couple months and have been super impressed
with its ease and speed.  But, that environment is under my programmatic
control, including the namespace design.  In fact what I'd really like
to be able to do is throw a configuration switch enabling a networked
LDAP server as an alternative to using the Orion JNDI namespace.  If
there were a JNDI.xml file or something like that, perhaps it would be
possible to organize the namespace in a way that makes best sense for
your enterprise application architecture; and of course other servers
would be able to share centralized resources.  To my thinking
DataSources kind of cry out for this approach.  Seems to be the J2EE
"way", although, I dunno, I'm still learning.

In case it helps, below are the entries in my data-sources.xml and
web.xml files, and a code example. These are taken directly from
Deepak's earlier posts.  With these I'm able to get a non-null
Connection reference from the DataSource.  But note this isn't to
declare victory: still have a strange bug to figure out.  My tag handler
blows up with a NullPointerException when I call
Connection.createStatement() on the Connection reference.  Have no idea
if this is related to the config below, or what, but the Exception is
being caught by Orion, not by my tag handler, which at first glance
points to Orion's implementation of the pooled Connection object.

Note to Mike Cannon-Brookes: based on the quantity of questions posted
to the mailing list, I'd suggest that proper configuration of
DataSources and also the workings of the Orion JNDI namespace are two
good candidates for your super-FAQ suggestion.  :-)

--Mark

>From data-sources.xml:

 <!-- NON-POOLED Oracle data source -->
 <data-source
      class="com.evermind.sql.DriverManagerDataSource"
      name="OracleNP"
      location="jdbc/OracleNP"
      xa-location="jdbc/xa/OracleXANP"
      ejb-location="jdbc/OracleNP"
      connection-driver="oracle.jdbc.driver.OracleDriver"
      username="foo"
      password="bar"
      url="jdbc:oracle:thin:@test:1521:DEV"
      inactivity-timeout="30"
      schema="database-schemas/oracle.xml"
 />

 <!-- POOLED Oracle data source -->
 <data-source
      class="com.evermind.sql.OrionPooledDataSource"
      name="OracleDS"
      location="jdbc/OracleDS"
      xa-location="jdbc/xa/OracleXADS"
      ejb-location="jdbc/OracleDS"
      max-connections="10"
      source-location="jdbc/OracleNP"
      pooled-location="jdbc/OracleDS"
      connection-driver="oracle.jdbc.driver.OracleDriver"
      username="foo"
      password="bar"
      url="jdbc:oracle:thin:@test:1521:DEV"
      inactivity-timeout="30"
      schema="database-schemas/oracle.xml"
 />

>From web.xml:

<context-param>
    <param-name>OracleDS</param-name>
    <param-value>jdbc/OracleDS</param-value>
</context-param>
<resource-ref>
    <description>Oracle pooled data source</description>
    <res-ref-name>OracleDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
</resource-ref>

>From the tag handler:

try {

    InitialContext cxt = new InitialContext();
    DataSource ds = (DataSource) cxt.lookup("java:comp/env/OracleDS");

    Connection c = ds.getConnection();
    if (c == null)
        System.out.println("==> Connection is null");
    else System.out.println("Connection is not null");

    /*     Blows up here with NullPointerException caught by Orion --
            NOT caught by the enclosing try/catch block.  Is this a bug
            in the Connection object, which I assume is Orion's
            implementation of a pooled version?  Should I post all this
            to Buzilla?  Dunno!:
*/
    Statement s = c.createStatement();
    if (s == null)
        System.out.println("==> Statement is null");
    else System.out.println("Statement is not null");

} catch  (Exception e) {
    System.err.println("==> Caught: " + e);
}

======================

Mark, what version of Orion are you using?  I wrote a little utility
that traverses the JNDI namespace, just looking for Context objects
and displaying what's in them.  I found an env Context but it was
empty!  I did eventually discover, due to a chance remark of someone
on the list, that there is in fact another Context which my scheme
did not find, namely jdbc/*.  I'm feeling pretty stupid about JNDI
these days, since I can't even figure out how to search the space,
despite the spec's indication that (as best I can tell) it's a
purely heirarchical namespace!

   Gary

On Today, Mark ([EMAIL PROTECTED]) wrote:

> Dunno if this is any help, but I found through experimentation that,
if
> you're using the deployment approach suggested by Deepak Goel in the
> thread "ANSWER: how to use pooled connections in Orion", the parameter

> to pass to InitialContext.lookup() is, as he notes,
> "java:comp/env/d123DS", not "java:comp/env/jdbc/d123DS".  That is,
> there's no "jdbc" in that String.  Just pointing that out because I
> missed it at first.
>
> (Yes, it seems to take a while for messages to get out to the list!)
>
> --Mark








Reply via email to