Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Charmaine Rebollido
Connecting to liferay database(mysql) without using service builder
March 30, 2010 3:04 AM
Answer

Charmaine Rebollido

Rank: Junior Member

Posts: 28

Join Date: December 11, 2009

Recent Posts

Hello,

Can anyone help me find out how can I create a portlet that can automatically access mysql and liferay database without using a service builder?

Also, without manually indicating in an sql statement the username and password of mysql in the portlet. I am using jsp/jsf in developing portlets.

Generally what I want to do is a portlet that can be dynamically deployed to different liferay portals without having to set the values of the username and password being used by that portal in its database and without using service builder.

I hope someone can help me with this and if possible can provide a step by step tutorial.

Thanks in advance.
emoticon
Manish Kumar Gupta
RE: Connecting to liferay database(mysql) without using service builder
March 30, 2010 3:26 AM
Answer

Manish Kumar Gupta

LIFERAY STAFF

Rank: Liferay Master

Posts: 535

Join Date: May 15, 2008

Recent Posts

In your portlet, you can use com.liferay.portal.kernel.dao.jdbc.DataAccess API to get the connection and do whatever you want to do in your portlet.
Charmaine Rebollido
RE: Connecting to liferay database(mysql) without using service builder
April 14, 2010 6:24 PM
Answer

Charmaine Rebollido

Rank: Junior Member

Posts: 28

Join Date: December 11, 2009

Recent Posts

Hi Manish,

Thanks for your reply, can you provide an example on how to use it? Thanks
Vijay Peddareddy
RE: Connecting to liferay database(mysql) without using service builder
April 20, 2012 11:38 AM
Answer

Vijay Peddareddy

Rank: New Member

Posts: 10

Join Date: March 14, 2012

Recent Posts

Charmaine Rebollido:
Hi Manish,

Thanks for your reply, can you provide an example on how to use it? Thanks



Hi Manish,

I know this is too old post. But I've the same question Charmaine posted. Could you please help out with any example ?

Charmaine, If you already found any solution to this issue, please share.

Thanks a lot in advance.

Regards
Vijay Peddareddy.
Hitoshi Ozawa
RE: Connecting to liferay database(mysql) without using service builder
April 21, 2012 7:59 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7949

Join Date: March 23, 2010

Recent Posts

This is a very old thread. With the recent versions, it's possible to use dynamic query to execute your own sql command.
Vijay Peddareddy
RE: Connecting to liferay database(mysql) without using service builder
April 24, 2012 8:10 AM
Answer

Vijay Peddareddy

Rank: New Member

Posts: 10

Join Date: March 14, 2012

Recent Posts

Hitoshi Ozawa:
This is a very old thread. With the recent versions, it's possible to use dynamic query to execute your own sql command.



Hi Hitoshi,

Thanks a lot for your reply.

Below is my requirement. Could you please help on how to achieve this in (Liferay 6.1 + Tomcat 7) environment:

Our customers want to use liferay with the separate SCHEMA (in same database) for client overrides, in other words we want to implement a solution
where every customer will get his own SCHEMA for client specific data and keep the liferay data in liferay database only.

For example : Table X is created in Liferay schema for Client1 data; same Table X is created in MyData schema for this client1. In this case Portlet should get data from X table of MyData Schema.
Table Y is created in Liferay Schema for Client2 data. There's no schema for Client2. So, in this case Portlet should get data from Y table of Liferay Schema only.

Thant means, On load of Portlet, I should be able to switch to client specific SCHEMA dynamically if there is one for logged in user otherwise I should use Liferay database only.

I'm able to achieve this through Service Builder. But, every time new SCHEMA is added (OR) every time this Portlet is deployed on to new Client Platform, we need to touch service.xml to generate code for the new schema. I want to overcome this.

Is there any other way to achieve this dynamically with no code change ??

I hope you understand what's my requirement is. Please help how to achieve this.

Thanks a lot in advance.
Vijay Peddareddy.