留言板

Change database configuration in liferay 6.2

Paloma Terán,修改在7 年前。

Change database configuration in liferay 6.2

New Member 帖子: 9 加入日期: 13-1-28 最近的帖子
Hello,

I have a server with liferay 6.2.
I put in dabatase url something like this:
jdbc:mysql://localhost:3306/sakila?profileSQL=true

profileSQL=true gives a lot of errors when I launch the server and I want to change it for jdbc:mysql://localhost:3306/sakila

Where can I change it?

Thx
thumbnail
David H Nebinger,修改在7 年前。

RE: Change database configuration in liferay 6.2

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
It will either be in portal-ext.properties or in your JNDI configuration.
Paloma Terán,修改在7 年前。

RE: Change database configuration in liferay 6.2

New Member 帖子: 9 加入日期: 13-1-28 最近的帖子
I´ve found the init configuration inside the file {tomcat-dir}/portal-setup-wizard.properties, this file contains my database configuration.
thumbnail
Ravi Darji,修改在7 年前。

RE: Change database configuration in liferay 6.2

Junior Member 帖子: 56 加入日期: 14-5-14 最近的帖子
Hi Paloma Terán,
Paloma Terán:
Hello,

I have a server with liferay 6.2.
I put in dabatase url something like this:
jdbc:mysql://localhost:3306/sakila?profileSQL=true

profileSQL=true gives a lot of errors when I launch the server and I want to change it for jdbc:mysql://localhost:3306/sakila

Where can I change it?

Thx



database url seems like not correct,
it should be like
jdbc.default.url=jdbc\:mysql\://localhost:3306/lportal?useUnicode\=true&characterEncoding\=UTF-8&useFastDateParsing\=false


And the best practice is database configuration should be in portal-ext.properties file.

Thanks & Regards,
Ravi Darji
+91 846 077 3036
thumbnail
David H Nebinger,修改在7 年前。

RE: Change database configuration in liferay 6.2

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
Ravi Darji:
And the best practice is database configuration should be in portal-ext.properties file.


This is actually wrong. Best practice is to put your DB connections into JNDI for your app container. If you put in portal-ext.properties you risk leaking information about your database. Check out the properties panel in the system admin control panel. Just search for jdbc. and you'll see all of your connection info. Liferay masks the password for default, but any 3rd party ones are not masked unless you too add the proper configuration.

Regardless you still leak your db server and principal, which is often all a skilled hacker needs to get started attacking your environment.
Graeme Busfield,修改在7 年前。

RE: Change database configuration in liferay 6.2

New Member 帖子: 3 加入日期: 16-9-13 最近的帖子
David
Are you saying that using the Liferay portal-ext.properties should be avoided? You state that Liferay masks the password, but then go on to say that the info given (database server etc) is enough for a skilled hacker to "get started attacking your environment". Therefore, is using portal-ext.properties a security risk??

The documentation from versions prior to 6.1 suggest using the portal-ext.properties file (see https://web.liferay.com/community/wiki/-/wiki/Main/Database+Configuration). I wasn't able to find similar documentation for versions 6.2 and above.

If portal-ext.properties should be avoided, can you give more details about implementing the JNDI?

Many thanks
Graeme
thumbnail
David H Nebinger,修改在7 年前。

RE: Change database configuration in liferay 6.2

Liferay Legend 帖子: 14919 加入日期: 06-9-2 最近的帖子
JNDI configuration is always seen as more secure than portal-ext.properties because it does not expose the password to the application container. Heck, it doesn't expose the database server and/or name (because the URL is hidden) nor does it expose the username used to connect.

The wiki as well as other Liferay documentation goes to the portal-ext.properties for database connection setup because it is an easy platform-neutral way to define the Liferay database connection information. That doesn't mean that Liferay recommends properties over JNDI or that it is the preferred way to connect.

As far as implementing it, well that depends upon your application server. Tomcat, for example, allows you to define in conf/Catalina/localhost/ROOT.xml for just the ROOT web application or in conf/context.xml to define the connection globally. Other app servers do things their own way and your best path is to review doco for your app server to see how to define a JNDI connection.
Graeme Busfield,修改在7 年前。

RE: Change database configuration in liferay 6.2

New Member 帖子: 3 加入日期: 16-9-13 最近的帖子
Many thanks. I had failed to appreciate that the JNDI approach is going to depend on the choice of app server.