Frank,
You can get a connection through the PortalStatistics object.
PortletContext context = getPortletContext();
PortalStatistics statistics =
(PortalStatistics)context.getAttribute(CommonPortletServices.CPS_PORTAL_STATISTICS);
statistics.getDataSource();
Before you can reference CPS_PORTAL_STATISTICS you have to edit the
WEB-INF/jetspeed-portlet.xml file. If it doesn't exist in your project then
you need to create it. Mine is listed below with a bunch of Jetspeed
services I use.
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2004 The Apache Software Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<portlet-app id="your-app-id" version="1.0"
xmlns="http://portals.apache.org/jetspeed"
xmlns:js="http://portals.apache.org/jetspeed"
xmlns:dc="http://www.purl.org/dc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://portals.apache.org/jetspeed
http://portals.apache.org/jetspeed-2/2.1/schemas/jetspeed-portlet.xsd">
<js:services>
<js:service name='GroupManager'/>
<js:service name='UserManager'/>
<js:service name='RoleManager'/>
<js:service name='PortalStatistics'/>
</js:services>
</portlet-app>
On Fri, Nov 14, 2008 at 7:27 AM, Otto, Frank <[EMAIL PROTECTED]> wrote:
> Hi,
>
> how can I get the database connection from jetspeed in my portlet?
>
>
> kind regards
>
> Frank
>