How to: Make external connections to an Access Web App
You may want to access the data stored in your Access Web app from other applications. An Access Web App stores its objects and data in a SQL Azure database for SharePoint Online instances or in a local SQL Server for SharePoint on-premise installations. In order to connect to the Access Web app data on SQL, you need to use the SQL Server Native Client 11.0 ODBC driver and provide connection information from the Access Web App. Below are the steps to make the most commonly requested connections.
Note: If you experience connection issues after following these instructions, you will want to ensure your firewall is not blocking port 1433. See Security Guidelines for Azure SQL Database for more details.
Prerequisite: Download and install the SQL Native Client 11.0 driver from the Microsoft® SQL Server® 2012 SP1 Feature Pack. Within the download details, the only file you need to select is the sqlncli.msi.
Enable Connections for your Access Web App
- Open the Access Web App in the Access client
- Click the File tab > Info > click Manage within the Connections group
- If your Access App is on SharePoint Online, select From Any Location or From My Location to allow connections. Note: If you are on an IPv6 network, you will only have the option to connect From Any Location. In an on-premise installation, these options are not available.
- Select either Enable Read-Only Connection or Enable Read-Write Connection
- Depending on the previous selection, select either View Read-Only Connection Information or View Read-Write Connection Information
- Copy and paste the Server, Database, UserName and Password values into Notepad or Word, or leave the Connection Information window open so you can copy and paste the information from it later.
Create an ODBC Data Source Name (DSN) to Connect to the Access Web App on SQL
Open the ODBC Data Source Administrator tool. There are many methods to access this tool so to eliminate confusion, I’ll provide the corresponding executable for the bitness of DSN you are looking to create. Note: The DSN bitness should match the bitness of your Office installation.
Windows 32bit (x86) / Office 32bit (x86): %windir%\System32\odbcad32.exe
Windows 64bit (x64) / Office 64bit (x64): %windir%\System32\odbcac32.exe
Windows 64bit (x64) / Office 32bit (x86): %windir%\SysWow64\odbcad32.exe
Note: %windir% typically points to the default location of Windows, or c:\windows
On the User DSN or System DSN tab of the ODBC Data Source Administrator dialog, click Add
Select the SQL Server Native Client 11.0 driver, click Finish
Provide any name you like for this new DSN
Enter the Server information gathered earlier from the Access Web App connection information, click Next
Select the With SQL Server authentication… option
Paste the UserName and Password from the Access Web App connection information, click Next
Select the ‘Change the default database to’ checkbox
Paste the database name* from the Access Web App connection information. Click Next
*Do not click the down arrow for the database name if you are connecting to a database on SQL Azure as you will not be able to view the list of available databases and will encounter an error. It’s best to copy/paste your specific database name into this field.
Click Finish, click Ok
Use the DSN within an Access desktop database
Now that you have created an ODBC DSN, you are able to use that connection information from many applications. Here are the steps to use this ODBC DSN to create linked tables within a traditional Access desktop database. For other applications, you will want to seek its help documentation on using ODBC connections.
- Create a new or open an existing Access desktop database
- On the ribbon, click the External Data tab
- Within the Import & Link group, click ODBC Database
- Select ‘Link to the data source by creating a linked table’, click Ok
- In the ‘Select Data Source’ dialog, click the Machine Data Source tab
- Select the ODBC DSN that you created, click Ok
- Provide the password from the Access Web App connection information, click Ok
- Select the tables you wish to link (Note: The tables named Access.<tablename> are the ones that contain the data.)
- Check the option Save Password if desired. This stores the password in the database file, but prevents you from having to enter the password each time you open the database
- Click Ok
- You should now see the linked table(s) in your desktop database (Note: You may rename the tables in the Access desktop database and remove the ‘Access_’ from the name.
- Doing so will not change the table names in the SQL database.)
Using SQL Server Management Studio (SSMS) to Connect to the Access App on SQL
In order to connect to the Access Web App from SSMS, you do not need to create an ODBC DSN, but you will need to first enable external connections by completing the section "Enable Connections for your Access Web App" above.
- Open SQL Server Management Studio
- In the 'Connect to Server’ dialog, use the connection information from the Access Web App to specify the server name
- Change the Authentication to ‘SQL Server Authentication’
- Provide the login and password also using the Access Web App connection information
- Click the Options >> button
- Select the Connection Properties tab
- Paste the database name using the Access Web App connection information for the ‘Connect to database’ option. *Do not use the dropdown arrow to attempt to locate the database name