Anthony,
Why you need Jetspeed specific DataSource for conencting to your
portlet application database?
I would suggest you to configure a separate data source in your
portlet application and use it for accessing database from your
portlet.
You will need to do the following?
1. Configure data source in server.xml or your application context
specific xml fragment.
2. Get reference to DataSource in your application using InitialContext.
3. Do whatever you want to do with database from within your application.
Regards,
Raj
On 3/14/06, Anthony Perritano <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a portlet that i want to access a mysql database. i keep
> running into this:
>
> Error on SQL: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
> create JDBC driver of class '' for connect URL 'null'
>
> looks like jetspeed.xml
>
> <Context path="/jetspeed" docBase="jetspeed" crossContext="true">
>
> <Realm className="org.apache.catalina.realm.JAASRealm"
> appName="Jetspeed"
>
> userClassNames="org.apache.jetspeed.security.impl.UserPrincipalImpl"
>
> roleClassNames="org.apache.jetspeed.security.impl.RolePrincipalImpl"
> useContextClassLoader="false"
> debug="0"/>
>
>
> <Resource name="jdbc/jetspeed" auth="Container"
> factory="org.apache.commons.dbcp.BasicDataSourceFactory"
> type="javax.sql.DataSource" username="jetspeed2"
> password="jetspeed2"
> driverClassName="com.mysql.jdbc.Driver"
> url="jdbc:mysql://blah:3306/j2"
> maxActive="100" maxIdle="30" maxWait="10000"/>
>
> <Resource name="jdbc/sailDB" auth="Container"
> factory="org.apache.commons.dbcp.BasicDataSourceFactory"
> type="javax.sql.DataSource" username="jetspeed2"
> password="j2"
> driverClassName="com.mysql.jdbc.Driver"
> url="jdbc:mysql://blah:3306/sail"
> maxActive="100" maxIdle="30" maxWait="10000"/>
> </Context>
>
> the jdbc/jetspeed works great, its the jdbc/sailDB that i am trying
> to connect to from my portlet.
>
> my datasource.xml has this:
>
> <bean id="sailDB"
> class="org.apache.jetspeed.components.rdbms.ojb.ConnectionRepositoryEntr
> y">
> <property name="driverClassName">
> <value>com.mysql.jdbc.Driver</value>
> </property>
> <property name="url">
> <value>jdbc:mysql://blah:3306/sail</value>
> </property>
> <property name="username">
> <value>jetspeed2</value>
> </property>
> <property name="password">
> <value>j2</value>
> </property>
> <property name="jndiName">
> <value>java:comp/env/jdbc/sailDB</value>
> </property>
> </bean>
>
> my web.xml in my portlet is:
>
> <resource-ref>
> <description>DB Connection</description>
> <res-ref-name>jdbc/sailDB</res-ref-name>
> <res-type>javax.sql.DataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
>
> and the code i use to get the datasource in my portlet is:
>
> DataSource ds = null;
>
> Context context = new InitialContext();
>
> ds = (DataSource) context.lookup("java:comp/env/jdbc/sailDB");
>
>
> am missing something some where???
>
> thanks
> Anthony
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]