Monday, July 8, 2013

Data Loader bean for SQL Server 2012 Express

To connect Salesforce's Data Loader (28.0) to a named instance of SQL Server 2012 Express:

  1. Set the SQL Server Browser service's startup type to "Automatic"
  2. Start the SQL Server Browser service
  3. Use SQL Server Configuration Manager to enable the TCP/IP protocol for the named instance
  4. Download the Microsoft JDBC Driver for SQL Server
  5. Extract the downloaded sqljdbc4.jar to %DATA_LOADER_HOME%\Java\lib\ext
  6. Create an org.apache.commons.dbcp.BasicDataSource bean in your \conf\database-conf.xml file by adapting the sample database-conf.xml bean for SQL Server 2012 Express
  7. Create a simple extract process to create records in SQL Server to test the configuration. Refer to this working set of database-conf.xml, process-conf.xml and an SDL file as a guide.

Additional Info

Along the way you may encounter numerous errors. Below are some of the ones I encountered and how they were resolved.

FATAL [main] process.ProcessRunner topLevelError (ProcessRunner.java:238) - Unable to run process sqlServerApplicationExtractjava.lang.RuntimeException: com.salesforce.dataloader.exception.DataAccessObjectInitializationException: Database error encountered during connecting for database configuration: insertApplication.  Sql error: Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.SQLServerDriver'.
  • Solution: Extract the downloaded sqljdbc4.jar to %DATA_LOADER_HOME%\Java\lib\ext

Caused by: java.lang.UnsupportedOperationException: Java Runtime Environment (JRE) version 1.6 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
  • Solution: Delete sqljdbc.jar from %DATA_LOADER_HOME%\Java\lib\ext
  • In my case, I had extracted both sqljdbc.jar and sqljdbc4.jar to the \Java\lib\ext folder

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host localhost, port 1433 has failed. Error: "Connection refused: connect. Verify the connection properties. Make sure that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port. Make sure that TCP connections to the port are not blocked by a firewall.".
  • Solution: Edit the connection string to specify a named instance, "localhost\SQLEXPRESS" instead of just specifying the server "localhost"

Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: The connection to the host IGNEOUS, named instance sqlexpress failed. Error: "java.net.SocketTimeoutException: Receive timed out". Verify the server and instance names and check that no firewall is blocking UDP traffic to port 1434.  For SQL Server 2005 or later, verify that the SQL Server Browser Service is running on the host.
  • Solution: Start the SQL Server Browser service

Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (The server sqlexpress is not configured to listen with TCP/IP.)

RedirectHelp Page to Integrate Google Sites with Salesforce for Context-Specific Help

If you want to use Google Sites for contextual documentation in Salesforce, the following steps will enable your users to trigger a contextual search in your Google site when they click "Help for this Page":

  1. Deploy the RedirectHelp page to a public site in your Salesforce org
  2. Open your Google site
  3. Perform a search for any keyword (e.g., "help")
  4. Copy the resulting URL. It should look something like, https://sites.google.com/a/granite.edu/technology-playbook/system/app/pages/search?scope=search-site&q=help
  5. Edit the RedirectHelp page. Set the baseURL variable to the Google site query URL, with {#section} inserted as a placeholder for the query keyword
  6. Copy the public URL of the RedirectHelp page
  7. On the "Help Settings" page in Salesforce, set the Re-direct Help URL to the public URL you just copied


Note: When you are satisfied with the functionality of the RedirectHelp page, you should set the pause variable to "0" so that the redirect is instantaneous.

Additional Info

Google Sites is a great, cost-effective way to create documentation for customized, enterprise systems such as Salesforce. However, integrating the two is not seamless out of the box.

Salesforce's Help Settings allow one to specify a Re-direct Help URL, which can be set to the base URL for a Google site. For example: https://sites.google.com/a/example.com/help/


But the Google site would not know what to do with the default loc, target and section parameters that Salesforce automatically adds to the URL.

Since the section parameter really provides the contextual keyword for the Online Help request, it would make sense to perform a search through the Google site for the keyword whenever a user clicks "Help for this page". Deploying the simple RedirectHelp page achieves this goal without custom Apex or JavaScript.

Note: This solution was last tested in Summer '13 DE and EE orgs.

Wednesday, July 3, 2013

Data Loader process.bat Error: The system cannot find the path specified

When trying to run process.bat for Salesforce's Data Loader from the command line, I encountered an error, "The system cannot find the path specified."

The problem turned out to be that I was not running process.bat from the %DATA_LOADER_HOME%\bin folder.

Running process.bat from the folder where the BAT file was located (shown below) solved the problem.


The root cause of the error is that process.bat (in Data Loader 28) looks for the JRE executable in a relative path, assuming the user is running the script from %DATA_LOADER_HOME%\bin.

Monday, July 1, 2013

How to Install Java 7 Plugin for Firefox on Windows Server 2008 R2

If you have to set up Windows Server 2008 R2 environments and try to get the JRE 7 plug-in to work in Firefox on the server, you may not have found it to be an intuitive process.

The quickest solution seems to be:
  1. Open Google, and search for "java plugin verify"
  2. Click the result with a title similar to "How do I test whether Java is working on my computer?" See the screenshot below for reference.
  3. Click the Free Java Download button
  4. Click the Agree and Start Free Download button. This should prompt you to download an installer such as "jxpinstall.exe".
  5. Once the download is complete, close Firefox
  6. Run the installer, and follow the on-screen instructions to complete the installation
  7. After the installation, return to the verification page to make sure the Java plugin for Firefox now works


For some reason, downloading and installing the JDK or the JRE from Oracle's website does not install the plugin correctly for Firefox. This is the only reliable way I've encountered so far of getting the plugin to work in Windows Server 2008 R2.