Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Pavan Gupta
Best practice to fetch data from external database (Non-Liferay DB)
August 30, 2012 6:08 AM
Answer

Pavan Gupta

Rank: New Member

Posts: 16

Join Date: August 28, 2012

Recent Posts

Hi,

I am using liferay 6.1 and trying to fetch data from a external database (Non- liferay Demoticon and display info on my portlet. i can think of following 2 approaches to achieve this:

1) One way to achieve this is to write a simaple jdbc java program which connects to my external database, run query and get the result.
2) second is to use liferay service builder tool to generate classes to interact with external database. that will involve hibernate concepts for communication between portlet and database.

Is there any other approach present to achieve the same and which approach is better is to use to get data from database?

Thanks,
Pavan
Nishikant sapkal
RE: Best practice to fetch data from external database (Non-Liferay DB)
August 30, 2012 6:18 AM
Answer

Nishikant sapkal

Rank: Junior Member

Posts: 71

Join Date: February 15, 2010

Recent Posts

Hi Pavan,

When you mean external DB (Non- liferay Demoticon it means non liferay tables means wanted to fetch the data from other than non LR tables. If its true then liferay service builder tool will be the best approach.

Best Regards,
Nishikant Sapkal
Pavan Gupta
RE: Best practice to fetch data from external database (Non-Liferay DB)
August 30, 2012 6:22 AM
Answer

Pavan Gupta

Rank: New Member

Posts: 16

Join Date: August 28, 2012

Recent Posts

Hi Nishikant,

Thanks for the quick response. from "External Database" i actually means non LR tables. i have some data stored in non LR tables. I want to fetch that data and display on my portlet.

Thanks,
Pavan
David H Nebinger
RE: Best practice to fetch data from external database (Non-Liferay DB)
August 30, 2012 2:17 PM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6983

Join Date: September 1, 2006

Recent Posts

It is still best to use Service Builder as native types of access (JPA, Hibernate, etc.) have hidden costs involved in the portlet world.

You can find examples of connecting SB entities to other databases. Your entity definition, creation, and usage patterns remain the same in your code after that.
Yatin Patel
RE: Best practice to fetch data from external database (Non-Liferay DB)
June 19, 2014 9:35 PM
Answer

Yatin Patel

Rank: New Member

Posts: 18

Join Date: October 12, 2011

Recent Posts

Hi David,

Thanks for your advice emoticon

Is there any best and easy blog or document for connect external database in liferay using service builder?

Thanks,
Yatin Patel
www.yatin-patel.com
Pankaj Kathiriya
RE: Best practice to fetch data from external database (Non-Liferay DB)
June 19, 2014 10:07 PM
Answer

Pankaj Kathiriya

Rank: Liferay Master

Posts: 612

Join Date: August 4, 2010

Recent Posts

There are many blogs available for it.

Just google
liferay service builder external database
, you will get many useful links there.


One example: http://liferaytrends.blogspot.com/2012/05/connecting-to-different-database-using.html