The current version of Pluto lives inside a Tomcat 5.5 container. Tomcat
handles server services such as JNDI and DataSource setup. For more
information, take a look at this page:
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html

If you have any other problems with this issue, you should probably ping a
Tomcat mail list.
/Craig



                                                                           
             teinkys                                                       
             <[EMAIL PROTECTED]                                             
             .com>                                                      To 
                                       [email protected]       
             11/21/2007 03:24                                           cc 
             AM                                                            
                                                                   Subject 
                                       Portlet with JDBC and integrated in 
             Please respond to         Pluto                               
             [EMAIL PROTECTED]                                             
               s.apache.org                                                
                                                                           
                                                                           
                                                                           
                                                                           





Hi! I'm developing a portlet with Eclipse and it will be integrated in
Pluto.
I need to access to a database Oracle using JDBC and JNDI.

I've added to my WEB-INF/web.xml the resource reference:

    <resource-ref>
        <description>Description</description>
        <res-ref-name>jdbc/DBexample</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

To connect I do:

    Context ctx = new InitialContext();
    DataSource ds = (DataSource)
ctx.lookup("java:/comp/env/jdbc/DBexample");
    Connection con = ds.getConnection();

I don't know exactly how to configure the DataSource.  At the moment I've a
META-INF/context.xml with the following:

    <context>
        <Resource name="jdbc/DBexample" auth="Container"
              type="javax.sql.DataSource" username="user"
password="password"
              driverClassName="oracle.jdbc.OracleDriver"

              url="jdbc:oracle:thin:@12.230.19.201:1522:DEVELOP2"
              maxActive="20" maxIdle="10"/>
    </context>

When I do a junit test it give me the following error:

        javax.naming.NoInitialContextException: Need to specify class name
in environment or
        system property, or as an applet parameter, or in an application
resource file:
        java.naming.factory.initial

This error is because don't  find the JNDI Resource (I think) but I don't
know where declare this Resource (remember that this portlet is integrated
in Pluto) and if I have to follow more steps (I've added the oracle driver
connector and Jakarta-Commons DBCP 1.2.2, Jakarta-Commons Collections 3.2,
Jakarta-Commons Pool 1.3 to the pluto server (Tomcat v5.5)).

Can you help me ? thanks.
--
View this message in context:
http://www.nabble.com/Portlet-with-JDBC-and-integrated-in-Pluto-tf4848715.html#a13872946

Sent from the Pluto - User mailing list archive at Nabble.com.

Reply via email to