Hello Joshua, You might try looking up:
myhms-datasource or jdbc/myhms-datasource instead of jdbc/MysqlDS The documentation from Orion should help you on this. I know I did the same thing using weblogic, but it took a couple of tries to get it to work. Also keep in mind that datasources can be webapp specific, so if you haven't set up a datasource in the webapp itself, you'll never find it using the "java:comp/env/jdbc/". I'd also recommend making getting a list of the names of all of the objects in your JNDI tree for future reference (after reading the Orion docs) :) Here's some code to help: package com.synctank.labs.jndi; import javax.naming.*; public class JNDILister { public static void main(String _arg[]){ Object o = null; InitialContext ctx= null; String start = "foo.bar"; if (_arg.length > 0) start = _arg[0]; try{ ctx = getInitialContext(); Context c = (Context)ctx.lookup(start); list(c); } catch (ClassCastException e) { System.out.println("Found a "+o.getClass().getName() +": "+o.toString() ); } catch (NamingException ne) { System.out.println("We have a problem!"); ne.printStackTrace(); } finally { try { ctx.close(); }catch (Exception e ) {} } } public static void list(Context _ctx) { StringBuffer sb = new StringBuffer(); try { NamingEnumeration enum = _ctx.listBindings(""); while (enum.hasMore()) { javax.naming.Binding binding = (javax.naming.Binding)enum.next(); Object obj = (Object)binding.getObject(); if (obj instanceof Context) { System.out.print("---> "); System.out.print(binding.getName()); System.out.print("."); list((Context)obj); } else { String name = binding.getName(); System.out.print("LEAF: "+name);// + " is "+ obj.getClass().getName()) ; } } } catch (NamingException e) { System.out.println(e); } } public static InitialContext getInitialContext() throws NamingException { // use the factory from your provider, this is an LDAP provider String factory = "com.sun.jndi.ldap.LdapCtxFactory"; // use the url of String url = "ldap://ldap.bigfoot.com:389"; String user = null; //the user name, if any String password = null; // password if any; java.util.Hashtable p = new java.util.Properties(); p.put(Context.INITIAL_CONTEXT_FACTORY, factory); p.put(Context.PROVIDER_URL, url); if (user != null && password != null ) { System.out.println("user: " + user); p.put(Context.SECURITY_PRINCIPAL, user); p.put(Context.SECURITY_CREDENTIALS, password); } return new InitialContext(p); } } Thursday, June 27, 2002, 9:00:44 AM, you wrote: JM> Hello, JM> I'd like to know if anyone is using J2EE defined JM> datasources in Cocoon? JM> I'm trying unsucessfully to connect to a MySQL JM> database using the Orion J2EE server. I've defined a JM> datasource in Orion: JM> <data-source JM> name="Mysql" JM> class="com.evermind.sql.DriverManagerDataSource" JM> schema="database-schemas/mysql.xml" JM> location="jdbc/MysqlDS" JM> xa-location="jdbc/xa/MysqlXADS" JM> ejb-location="jdbc/MysqlDS" JM> connection-driver="org.gjt.mm.mysql.Driver" JM> username="root" JM> password="" JM> url="jdbc:mysql://localhost/myhms" JM> inactivity-timeout="30" JM> /> JM> I can get a javax.sql.DataSource using the following JM> code from within a custom class called by a custom JM> Transformer: JM> DataSource ds = (DataSource) new JM> InitialContext().lookup("jdbc/MysqlDS"); JM> I then defined this datasource in cocoon.xconf: JM> <j2ee name="myhms-datasource"> JM> <dbname>MysqlDS</dbname> JM> </j2ee> -- Best regards, Russell mailto:[EMAIL PROTECTED] --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faq/index.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>