Blogs
This is a quick post on installing Liferay DXP to a SQL Server database.
The Liferay documentation does include the database properties that make up the connection string. But things weren’t as clear when SQL Server is setup for windows integrated authentication, hence this post.
The steps below are presented assuming you are setting up a brand new Liferay installation and pointing it to a SQL Server database using the initial Basic Configuration page that comes up following the first startup of a Liferay server. You could use portal-ext.properties to specify the connection URL provided below.
- Extract the Liferay DXP bundle.
- Add the jdbc driver jar to the classpath.
- Download the Sql Server JDBC Driver and copy the relevant jar to your
tomcat/lib/ext/.
- Download the Sql Server JDBC Driver and copy the relevant jar to your
- Start the server.
- When presented with the Basic Configuration screen, click Change to change the database from the hsql that ships with Liferay.
- Tweak your connection URL. This is important. Note the integratedSecurity=true.
jdbc:sqlserver://hostname;databaseName=databasename;integratedSecurity=true;
- Clear your username and password. You’re using Windows integrated authentication, so you don’t need the database user.
- That’s not all though. If you attempt to test your configuration by clicking Finish with the above, you will see an error in the logs.
This driver is not configured for integrated authentication.
...
...
Caused by: java.lang.UnsatisfiedLinkError: no sqljdbc_auth in java.library.path sqljdbc_auth.dllis the missing piece. You should be able to find that DLL file in an auth subfolder of your JDBC Driver download. Place that DLL file somewhere on your file system. IMPORTANT: THIS IS DEFICIENT. SEE COMMENTS AFTER READING. Then make these two changes to yourcatalina.bat.- Add the below line just before
rem Execute Java with the applicable properties.
rem Set the Java library path to help the JVM locate sqljdbc_auth.dll for integrated authentication
set JAVA_LIB_PATH=c:\app\drivers - After
rem Execute Java with the applicable properties, there should be a few calls to run tomcat in different execution scenarios. For each of those calls, insert the JVM parameter,java.library.path, and assign the value of the environment variable%JAVA_LIB_PATH%as its argument. One such call is shown below with the new JVM argument shown in bold.
%_EXECJAVA% %LOGGING_CONFIG% %LOGGING_MANAGER% %JAVA_OPTS% %CATALINA_OPTS% %DEBUG_OPTS% -D%ENDORSED_PROP%="%JAVA_ENDORSED_DIRS%" -classpath "%CLASSPATH%" -Dcatalina.base="%CATALINA_BASE%" -Dcatalina.home="%CATALINA_HOME%" -Djava.io.tmpdir="%CATALINA_TMPDIR%" -Djava.library.path=%JAVA_LIB_PATH% %MAINCLASS% %CMD_LINE_ARGS% %ACTION%Make sure you tweak all the Tomcat execution scenarios.
- Add the below line just before
Restart Liferay.