Congratulations Mark, and thanks for the summary! I hadn't looked
at how to do that very last line of code yet, I'm happy to see it
is so straight-forward.
Gary
On Yesterday, Mark ([EMAIL PROTECTED]) wrote:
> Fixed it! Yay!
>
> Gary, I tried it again per the suggestion you forwarded from support,
> but this time by removing the <resource-ref> from my web.xml and coding
> my Java as you noted: "jdbc/etc". Also fixed the startup problem by
> removing a transparently stupid syntax error from data-sources.xml.
>
> In case anybody else has been following this thread, here's the working
> <data-source> and a code fragment:
>
> <data-source
> name="Oracle data source"
> class="com.evermind.sql.ConnectionDataSource"
> location="jdbc/OracleDS"
> pooled-location="jdbc/OraclePooledDS"
> xa-location="jdbc/xa/OracleXADS"
> ejb-location="jdbc/OracleEJBDS"
> url="jdbc:oracle:thin:@dracula.smartmonsters.com:1521:DEV"
> connection-driver="oracle.jdbc.driver.OracleDriver"
> username="foo"
> password="bar"
> schema="database-schemas/oracle.xml"
> />
>
> InitialContext cxt = new InitialContext();
> // WRONG: DataSource ds = (DataSource)
> cxt.lookup("java:comp/env/OracleDS");
> DataSource ds = (DataSource) cxt.lookup("jdbc/OracleEJBDS"); // RIGHT
> Connection c = ds.getConnection();
>
> So the moral of the story seems to be, don't use the syntax
> "java:comp/env/myDS"; rather, use "jdbc/myDS".
>
> Note I've substituted "OracleEJBDS" per the note from support which Gary
> included earlier in the thread.
>
> Finally -- 'cause I'm personally done with this thread for a while, ;-)
> -- if any of the Evermind folks are taking note, I'd very much like to
> be able to choose to use networked LDAP for objects such as
> DataSources. Please consider this an enhancement suggestion.
>
> Thanks Gary, Allen and Deepak!
>
> --Mark