Foros de discusión

Connecting to liferay database(mysql) without using service builder

Charmaine Rebollido, modificado hace 14 años.

Connecting to liferay database(mysql) without using service builder

Junior Member Mensajes: 28 Fecha de incorporación: 12/12/09 Mensajes recientes
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
thumbnail
Manish Kumar Gupta, modificado hace 14 años.

RE: Connecting to liferay database(mysql) without using service builder

Liferay Master Mensajes: 535 Fecha de incorporación: 16/05/08 Mensajes recientes
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, modificado hace 14 años.

RE: Connecting to liferay database(mysql) without using service builder

Junior Member Mensajes: 28 Fecha de incorporación: 12/12/09 Mensajes recientes
Hi Manish,

Thanks for your reply, can you provide an example on how to use it? Thanks
Vijay Peddareddy, modificado hace 12 años.

RE: Connecting to liferay database(mysql) without using service builder

New Member Mensajes: 10 Fecha de incorporación: 14/03/12 Mensajes recientes
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.
thumbnail
Hitoshi Ozawa, modificado hace 12 años.

RE: Connecting to liferay database(mysql) without using service builder

Liferay Legend Mensajes: 7942 Fecha de incorporación: 24/03/10 Mensajes recientes
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, modificado hace 11 años.

RE: Connecting to liferay database(mysql) without using service builder

New Member Mensajes: 10 Fecha de incorporación: 14/03/12 Mensajes recientes
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.