Foren

Change database configuration in liferay 6.2

Paloma Terán, geändert vor 7 Jahren.

Change database configuration in liferay 6.2

New Member Beiträge: 9 Beitrittsdatum: 28.01.13 Neueste Beiträge
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, geändert vor 7 Jahren.

RE: Change database configuration in liferay 6.2

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
It will either be in portal-ext.properties or in your JNDI configuration.
Paloma Terán, geändert vor 7 Jahren.

RE: Change database configuration in liferay 6.2

New Member Beiträge: 9 Beitrittsdatum: 28.01.13 Neueste Beiträge
I´ve found the init configuration inside the file {tomcat-dir}/portal-setup-wizard.properties, this file contains my database configuration.
thumbnail
Ravi Darji, geändert vor 7 Jahren.

RE: Change database configuration in liferay 6.2

Junior Member Beiträge: 56 Beitrittsdatum: 14.05.14 Neueste Beiträge
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, geändert vor 7 Jahren.

RE: Change database configuration in liferay 6.2

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
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, geändert vor 7 Jahren.

RE: Change database configuration in liferay 6.2

New Member Beiträge: 3 Beitrittsdatum: 13.09.16 Neueste Beiträge
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, geändert vor 7 Jahren.

RE: Change database configuration in liferay 6.2

Liferay Legend Beiträge: 14919 Beitrittsdatum: 02.09.06 Neueste Beiträge
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, geändert vor 7 Jahren.

RE: Change database configuration in liferay 6.2

New Member Beiträge: 3 Beitrittsdatum: 13.09.16 Neueste Beiträge
Many thanks. I had failed to appreciate that the JNDI approach is going to depend on the choice of app server.