To the best of my knowledge, Jetspeed is wiring it via Spring in
WEB-INF/assembly/boot/datasource.xml.  The Spring bean is called
"JetspeedDS".

Tim Garrett
Software Engineer
Saepio Technologies
[EMAIL PROTECTED]
816.777.2158
Saepio Makes Distributed Marketing Effective, Engaging & Easy.

-----Original Message-----
From: Dan Olsen [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 03, 2008 10:38 AM
To: Jetspeed Users List <jetspeed-user@portals.apache.org
Subject: Accessing Jetspeed Database

I am trying to access the Jetspeed database. There is a jetspeed.xml
file in {tomcat_dir}/conf/Catalina/localhost/. I know Jetspeed can
access the database but I can't seem to get access to it. Does anyone
know how Jetspeed is setting up the database connection? When I try the
following code, I get a naming exception. If anyone knows why that code
does not get the work please let me know ASAP. Thanks!
 
==== BEGIN MY getConnection FUNCTION ==== public static Connection
getConnection(RenderResponse response)
   throws IOException {
  // TODO Auto-generated method stub
  try {
   Context initCtx = new InitialContext();
   Context envCtx = (Context) initCtx.lookup("java:/comp/env");
   if (envCtx == null) {
    throw new Exception("Boom - No Environment Context");
   }
   // envCtx.1
   DataSource ds = (DataSource) envCtx.lookup("jdbc/jetspeed");
   if (ds != null) {
    return ds.getConnection();
   } else {
    return null;
   }
  } catch (NamingException ex) {
   ex.printStackTrace(response.getWriter());
  } catch (Exception ex) {
   ex.printStackTrace(response.getWriter());
  }
 
  return null;
 }
 
==== END MY getConnection FUNCTION ====

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to