How to link a SQL Server database to an Assembla.com repository using Perforce

Applies to
ApexSQL Source Control

Summary
This article explains how to link a database to a Perforce repository hosted by Assembla.com

Description

ApexSQL Source Control natively supports Perforce which means that you do not need any third-party client in order to connect to a Perforce server. However, if you want to work with a repository hosted on Assembla.com, due to specific implementation details on host side there are some specific steps that need to be set before establishing a connection.

  • Install Perforce command-line client which can be found at this link

  • Make sure that the path to the P4.exe file is set in the PATH environment variable, under Windows environment variables:

  • Create a p4config.txt file in the ApexSQL Source Control Log folder path:

    C:\Users\<user>\AppData\Local\ApexSQL\ApexSQLSourceControl

  • Fill it with the following values:

    P4PORT=<Assembla server address (P4PORT) e.g.ssl:perforce.assembla.com:1667>
    P4HOST=<Assembla depot address (P4HOST) e.g. depot/main>
    P4USER=<Assembla username>
    P4CHARSET=utf8

  • Quick tip icon

    Quick tip:

    You can place the p4config.txt file on another location and later set the P4 client to look in specified path.

    Set the p4config.txt file as a config file for the P4 client. To accomplish this:

    • Open the Command Prompt
    • Navigate to the Perforce command client installation directory
    • Run the following command:

        p4 set P4CONFIG= <path_to_config_file>\p4config.txt

  • Check if everything is ok by running the p4 info command from the command prompt. If everything is properly specified in the previous steps, the expected output should be similar to the following:

  • Quick tip icon

    Quick tip:

    Connectivity and credentials can be checked by running the p4 login command. In case the user name exists, password will be requested to complete the operation.

  • Link a database to the repository using ApexSQL Source Control. Login details are as follows:

The Host field should be the same as the P4PORT variable defined in the p4config.txt file.

The Depot field should always be “depot/main” as that is the internal structure of the depot defined in the P4HOST variable.

The Workspace field represents the name of the workspace and it is left for the user to define it.

FAQs

Q: Are these steps necessary for connection to any Perforce server?

A: No, these steps are necessary only when linking a database to Assembla repositories, due to the specific implementation on the host side. If you are connecting directly to any Perforce server there is no need for these steps, and even the P4 command-line client is not necessary.

Q: Does the add-in capture any errors occurred during the database linking process?

A: The add-in will capture any exceptions thrown by the client and show them to the user. However, the common error message ‘Partner exited unexpectedly’ does not provide any additional information

Q: Can I change the port, or it is specified by the assembla.com?

A: Host field content, both the server address and port number are defined by Assembla.com itself.

Q: What if I additionally modify the content or the location of the P4 config file?

A: In case that the location is modified P4 client needs to be set to look in the new location by running the

  p4 set P4CONFIG= <path_to_config_file>\p4config.txt command