8

提交阶段总是失败并出现以下错误:

Committing Deployment Failed
Phase: Deployment Prepare Commit Phase failed, Unable to prepare transaction: tcm:0515104-66560,
org.hibernate.exception.JDBCConnectionException: Cannot open connection,
org.hibernate.exception.JDBCConnectionException: Cannot open connection, Unable to prepare transaction: tcm:0-515104-66560, 
org.hibernate.exception.JDBCConnectionException: Cannot open connection,
org.hibernate.exception.JDBCConnectionException: Cannot open connection

这是适用于具有默认实例 (DEV/UAT) 的数据库的配置:

<Storage Type="persistence" Id="brokerdb" dialect="MSSQL" Class="com.tridion.storage.persistence.JPADAOFactory">
            <Pool Type="jdbc" Size="5" MonitorInterval="60" IdleTimeout="120" CheckoutTimeout="120" />
            <DataSource Class="com.microsoft.sqlserver.jdbc.SQLServerDataSource">
                <Property Name="serverName" Value="ourServerName" />
                <Property Name="portNumber" Value="1433" />
                <Property Name="databaseName" Value="Tridion_Broker" />
                <Property Name="user" Value="TridionBrokerUser" />
                <Property Name="password" Value="xxxxxxxxpassxx" />
            </DataSource>
        </Storage> 

但是,对于我们的生产,使用命名实例是不可避免的。所以我们尝试了这个配置来传递实例的名称,但无济于事;我们仍然得到错误。

<Storage Type="persistence" Class="com.tridion.storage.persistence.JPADAOFactory" 
    Id="brokerdb"
    Url="jdbc:sqlserver://ourServerName/Tridion_Broker;instanceName=THE_INSTANCE_NAME;domain=DOMAIN_NAME" 
    Username="TridionBrokerUser" 
    Password="xxxxxxxxpassxx" 
    Driver="com.microsoft.sqlserver.jdbc.SQLServerDataSource">
    <Pool Type="jdbc" Size="5" MonitorInterval="60" IdleTimeout="120" CheckoutTimeout="120"/>
</Storage>

连接字符串有什么问题吗?或者有没有办法使用第一个模式传递实例名称;比如说<Property Name="instanceName" Value="THE_INSTANCE_NAME" />

4

5 回答 5

6

Both Nikoli and Gertjan's reference made me realize that the instance name is not required. An alternative is to specify the port to which the instance is running on.

This article showed me how to know which port is being used for the instance.

This configuration worked:

<Storage Type="persistence" Id="brokerdb" dialect="MSSQL" Class="com.tridion.storage.persistence.JPADAOFactory">
        <Pool Type="jdbc" Size="5" MonitorInterval="60" IdleTimeout="120" CheckoutTimeout="120" />
        <DataSource Class="com.microsoft.sqlserver.jdbc.SQLServerDataSource">
            <Property Name="serverName" Value="ourServerName" />
            <Property Name="portNumber" Value="43333" />
            <Property Name="databaseName" Value="Tridion_Broker" />
            <Property Name="user" Value="TridionBrokerUser" />
            <Property Name="password" Value="xxxxxxxxpassxx" />
        </DataSource>
    </Storage> 

I also tried the connection string approach and it worked, too:

<Storage Type="persistence" Class="com.tridion.storage.persistence.JPADAOFactory" 
    dialect="MSSQL" 
    Id="brokerdb" 
    Url="jdbc:sqlserver://ourServerName:43333;databaseName=Tridion_Broker;" 
    Username="TridionBrokerUser" Password="xxxxxxxxpassxx" 
    Driver="com.microsoft.sqlserver.jdbc.SQLServerDataSource">
    <Pool Type="jdbc2" Size="5" MonitorInterval="60" IdleTimeout="120" CheckoutTimeout="120"/>
</Storage>
于 2012-10-09T06:13:58.587 回答
3

您可以尝试以下方法:

<Property Name="serverName" Value="ourServerName\ourInstanceName" />
于 2012-10-08T11:50:42.320 回答
2

您指定 URL 的原始语法是正确的,但是,在检查文档后,我似乎找不到名为“域”的有效属性。这可能是你的罪魁祸首。尝试使用“\”在用户名中指定域。

于 2012-10-08T12:33:33.190 回答
2

根据这篇msdn文章:http: //msdn.microsoft.com/en-us/library/ms378428.aspx

你应该像这样配置它:

jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]
于 2012-10-08T13:55:53.647 回答
1
于 2012-10-08T21:21:21.287 回答