« 返回到 Custom Deployments

Tomcat with SQL Server 2008

Introduction #

This page provides the configuration settings to set up Apache Tomcat 6 with SQL Server 2008.

Configurations for JDBC Connection #

Set portal-ext.properties #

Location:

webapps\ROOT\WEB-INF\classes\portal-ext.properties

Content in portal-ext.properties:

# SQL Server
# jdbc.default.jndi.name=    
jdbc.default.driverClassName=net.sourceforge.jtds.jdbc.Driver
jdbc.default.url=jdbc:jtds:sqlserver://<machineName>/lportal
jdbc.default.username=<user>
jdbc.default.password=<password>

Setting jdbc.properties #

Location:

webapps\wol-portlet\WEB-INF\jdbc.properties

Relevant Content in jdbc.properties:

    #jira.driverClassName=org.hsqldb.jdbcDriver
    #jira.url=jdbc:hsqldb:mem:jira
    #jira.username=sa
    #jira.password=
    jira.driverClassName=net.sourceforge.jtds.jdbc.Driver
    jira.url=jdbc:jtds:sqlserver://<machineName>/lportal
    jira.username=<user>
    jira.password=<password>

Configurations for JNDI Connection #

Set portal-ext.properties #

Location:

webapps\ROOT\WEB-INF\classes\portal-ext.properties

Relevant Content in portal-ext.properties:

# SQL Server
jdbc.default.jndi.name=<jndiName>    
# jdbc.default.driverClassName=net.sourceforge.jtds.jdbc.Driver
# jdbc.default.url=jdbc:jtds:sqlserver://<machineName>/lportal
# jdbc.default.username=<user>
# jdbc.default.password=<password>

Note: For JNDI configuration you need just one line, the jndi name. The rest is configured through your application server - no need for db-name, driver, username and password in portal-ext.properties

Set ext-spring.xml #

Location:

webapps\wol-portlet\WEB-INF\src\META-INF\ext-spring.xml

Relevant Content in ext-spring.xml:

    <!--<bean id="jiraDataSourceTarget" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="${jdbc.jira.driverClassName}" />
        <property name="url" value="${jdbc.jira.url}" />
        <property name="username" value="${jdbc.jira.username}" />
        <property name="password" value="${jdbc.jira.password}" />
    </bean>-->
    <bean id="jiraDataSourceTarget" class="com.liferay.portal.spring.jndi.JndiObjectFactoryBean" lazy-init="true">
        <property name="jndiName">                                     
            <value>jdbc/<your jndiName></value>
        </property> 
    </bean>

Configuration for both Connection Types #

jtds.jar #

In "bundles/common/lib/ext" make sure that the "jtds.jar" is present. If it is not there obtain it and put it there.

Database #

Check for the lportal database. If not such database is present then download "liferay-portal-sql-x.x.x.zip" and run the SQL script.

Troubleshooting #

  • Make sure SQL Server has TCP connections enabled
  • Try adding the port number to the jdbc.default.url
0 附件
67497 查看
平均 (1 投票)
满分为 5,平均得分为 4.0。
评论
讨论主题回复 作者 日期
The jdbc.default.jndi.name is not required and... Brent De Vela 2009年5月22日 上午12:55
I tried setting this up with liferay 6.0.6. 1.... Luc Pannekoeke 2011年4月19日 上午8:42
Can we encrypt the password somehow? I've seen... Bill B 2012年9月17日 上午7:38
Yes, as discussed at... Bill B 2012年9月17日 上午9:34

The jdbc.default.jndi.name is not required and I used SQL Server Authentication mode because my Windows Authentication account did not work. Sample configuration below:

jdbc.default.driverClassName=net.sourceforge.jtds.jdbc.Driver
jdbc.default.­url=jdbc:jtds:sqlserver://MachineName/lportal
jdbc.default.username=sa
jdbc.defaul­t.password=Password
在 09-5-22 上午12:55 发帖。
I tried setting this up with liferay 6.0.6.

1. there is no more wol-portlet
2. i get authentication failed.

I can log fine via the sql client but it doesnt work with liferay. my settings are :

jdbc.default.jndi.name=<jndiName> jdbc.default.driverClassName=net.sourceforge.jtds.jdbc.Driver jdbc.default.url=jdbc:jtds:sqlserver://<machineName>/Liferayjdbc.default.usernam­e=<domain>/<user>
jdbc.default.password=<password>

Does it matter if the authentication has to happen against Active Directory ?
在 11-4-19 上午8:42 发帖以回复 Brent De Vela
Can we encrypt the password somehow? I've seen encrypted passwords for other applications with JDBC. It's hard to retreat to plain-text.
在 12-9-17 上午7:38 发帖。
Yes, as discussed at http://www.liferay.com/community/forums/-/message_boards/message/4634583
在 12-9-17 上午9:34 发帖以回复 Bill B