Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Charmaine Rebollido
Connecting to liferay database(mysql) without using service builder
30. März 2010 03:04
Antwort

Charmaine Rebollido

Rang: Junior Member

Nachrichten: 28

Eintrittsdatum: 11. Dezember 2009

Neue Beiträge

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
30. März 2010 03:26
Antwort

Manish Kumar Gupta

LIFERAY STAFF

Rang: Liferay Master

Nachrichten: 535

Eintrittsdatum: 15. Mai 2008

Neue Beiträge

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
14. April 2010 18:24
Antwort

Charmaine Rebollido

Rang: Junior Member

Nachrichten: 28

Eintrittsdatum: 11. Dezember 2009

Neue Beiträge

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
20. April 2012 11:38
Antwort

Vijay Peddareddy

Rang: New Member

Nachrichten: 10

Eintrittsdatum: 14. März 2012

Neue Beiträge

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
21. April 2012 07:59
Antwort

Hitoshi Ozawa

Rang: Liferay Legend

Nachrichten: 7949

Eintrittsdatum: 23. März 2010

Neue Beiträge

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
24. April 2012 08:10
Antwort

Vijay Peddareddy

Rang: New Member

Nachrichten: 10

Eintrittsdatum: 14. März 2012

Neue Beiträge

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.