Fórumok

Nyitólap » Liferay Portal » English » 3. Development

Kombinált nézet Egyszerű nézet Fa-nézet
Szálak [ Előző | Következő ]
toggle
Alaa Hendi
conenction pool for portlet
2009. június 16. 5:11
Válasz

Alaa Hendi

Rangsorolás: Junior Member

Hozzászólások: 34

Csatlakozás dátuma: 2009. február 10.

Legújabb hozzászólások

Hi all..
I Have mysql database for liferay portal, but i have portlet that use oracle DB, and this portlet should use connection pool .
how can i configure connection pool for this portlet?


Thanks
Rice Owl
RE: conenction pool for portlet
2009. június 16. 6:12
Válasz

Rice Owl

Rangsorolás: Regular Member

Hozzászólások: 177

Csatlakozás dátuma: 2009. április 23.

Legújabb hozzászólások

What app server is LifeRay running on? You should create a connection via the app server (JNDI). For instance, I'm running the Tomcat + LifeRay bundle and I define a separate DB conneciton in Tomcat by updating the server.xml file. This creates a DB connection pool which can be accessed via JNDI. So depending on what app server you have running will determine the steps to creating a DB connection.

Alaa Hendi:
Hi all..
I Have mysql database for liferay portal, but i have portlet that use oracle DB, and this portlet should use connection pool .
how can i configure connection pool for this portlet?


Thanks
Alaa Hendi
RE: conenction pool for portlet
2009. június 16. 7:10
Válasz

Alaa Hendi

Rangsorolás: Junior Member

Hozzászólások: 34

Csatlakozás dátuma: 2009. február 10.

Legújabb hozzászólások

i am using tomcat..
actually what i did is :
edit server.xml,adding:
 1 <Resource
 2            auth="Container"
 3            driverClassName="oracle.jdbc.driver.OracleDriver"
 4            factory="org.apache.commons.dbcp.BasicDataSourceFactory"
 5            maxActive="3"
 6            maxIdle="3"
 7            name="jndi/liferayDB"
 8            username="test"
 9            password="test123"
10            removeAbandoned="true"
11            removeAbandonedTimeout="120"
12            type="javax.sql.DataSource"
13            url="jdbc:oracle:thin:@DBServer:1521:KY" />


and then editing context.xml ,adding:
1     <ResourceLink global="jndi/liferayDB" name="jndi/liferayDB" type="javax.sql.Datasource"/>




but i have feeling that it is wrong way, is it? emoticon
Rice Owl
RE: conenction pool for portlet
2009. június 16. 9:25
Válasz

Rice Owl

Rangsorolás: Regular Member

Hozzászólások: 177

Csatlakozás dátuma: 2009. április 23.

Legújabb hozzászólások

That's actually pretty close, if not correct. In a few hours I can check my configuration and verify. The server.xml looks right to me (but I'll double check it when I can). The ResourceLink tag, I know I didn't put in context.xml, although this may be perfectly fine. I put the ResourceLink in the conf/localhost/<AppName>.xml file (from the top of my head i think that's the directory). Basically, each deployed application gets an associated <AppName>.xml file in this directory. I put the ResourceLink in that file. The context.xml may be another way of doing it, but I did it via the <AppName>.xml file to link the resource in the server.xml to the web app.

In a few hours I'll post what I had done.

Alaa Hendi:
i am using tomcat..
actually what i did is :
edit server.xml,adding:
 1 <Resource
 2            auth="Container"
 3            driverClassName="oracle.jdbc.driver.OracleDriver"
 4            factory="org.apache.commons.dbcp.BasicDataSourceFactory"
 5            maxActive="3"
 6            maxIdle="3"
 7            name="jndi/liferayDB"
 8            username="test"
 9            password="test123"
10            removeAbandoned="true"
11            removeAbandonedTimeout="120"
12            type="javax.sql.DataSource"
13            url="jdbc:oracle:thin:@DBServer:1521:KY" />


and then editing context.xml ,adding:
1     <ResourceLink global="jndi/liferayDB" name="jndi/liferayDB" type="javax.sql.Datasource"/>




but i have feeling that it is wrong way, is it? emoticon
Rice Owl
RE: conenction pool for portlet
2009. június 16. 12:32
Válasz

Rice Owl

Rangsorolás: Regular Member

Hozzászólások: 177

Csatlakozás dátuma: 2009. április 23.

Legújabb hozzászólások

Okay, I double checked my tomcat setup. Your server.xml is correct. I'm not sure about the context.xml, the line is correct though. There are usually many ways to do something, so it may be right, just give a try.

The difference I had was updating a file in {tomcatdir}/conf/Catalina/localhost. The file is called ROOT.xml (for the ROOT application). I added the line you added to context.xml to this file. If you have other web applications that need access, you'd create a new file in that same directory and put the line in there as well. For instnace, if you have a web app deployed w/ a context name of "MyPortlets", you'd create a file called MyPortlets.xml and put the resource link in there. ROOT should already be there as I think it comes with the bundled installation (if you use the bunded installation). THis will enable the ROOT application to get access to your connection pool. Hope that helped. Let me know if the context.xml update works too, that may be a better way to do it if it does what I think it may do (give all apps access to the JNDI name).
Victor Zorin
RE: conenction pool for portlet
2009. június 16. 18:22
Válasz

Victor Zorin

Rangsorolás: Liferay Legend

Hozzászólások: 1129

Csatlakozás dátuma: 2008. április 14.

Legújabb hozzászólások

We only use context.xml for this, sample code is here.
Alaa Hendi
RE: conenction pool for portlet
2009. június 18. 2:56
Válasz

Alaa Hendi

Rangsorolás: Junior Member

Hozzászólások: 34

Csatlakozás dátuma: 2009. február 10.

Legújabb hozzászólások

Ok.thanks all,
seems the changes will be at context.xml