krb5.conf
file to use Kerberos authentication.
Rebuilding FreeTDS
- Run the following command to pull down the existing recipe for the freetds conda package located here.:
- Open the recipe used to build the package:
- Run the following commands to open the recipe, and update it to enable krb5:
- Open the
meta.yml
file included in the recipe, and turn on line numbers:
- Make the following changes to the
meta.yaml
file:
- Change the version by editing line 2 so it looks like this:
{% set version = "1.1.4" %}
- Comment out line 3.
- Comment out lines 12-14.
- Add
krb5
to therequirements:host
section.
meta.yaml
file should look like this:
- Move up a directory, to enter
freetds-feedstock
:
- Run the following command to build the package:
freetds
package that supports Kerberos authentication. You can now upload this package to a channel, to use it in your projects and optionally share it with other users(../../packages/channels#sharing-channels).
- When complete, the output of the process will display the path to the package. Now you can upload it to your preferred channel, to make it available for platform users. For more information, see uploading a package to a channel.
Configuring Workbench
The following steps need to be performed on the master node of the Workbench cluster, so if you don’t have access to it, you’ll need to ask an Administrator to do the following:
- On the master node, create a
freetds.conf
file for your organization that looks similar to the following (replacing placeholder values with actual values):
- On the master node, create an
odbcinst.ini
file that looks similar to the following:
This example uses the Python 3.6 kernel. The location of the driver might be different if you are using a different kernel version.
- On the master node, create an
odbc.ini
file that looks similar to the following:
- After you’ve created these files, use the
anaconda-enterprise-cli
to ensure they are placed in every project. If the files are all in the current working directory, you can do this by running the following command on the master node:
- Run this command to update the secret in Kubernetes:
Connecting to MS SQL from a project
- Create or open a project that uses a minimal Python environment.
- To ensure that the correct libraries are installed, open the terminal within the project and run the following command:
Any packages you install from the command line are available during the current session only. If you want them to persist, add them to the project’s
anaconda-project.yml
file. For more information, see Project configurations.- When the install is complete, run the following command to verify whether you can successfully authenticate using Kerberos, replacing
<USERNAME>
with your credentials:
- If you were able to authenticate, run these commands to ensure you can connect to the MS SQL server, replacing
<SERVERNAME>
with the value you specified in thefreetds.conf
andodbc.ini
files.:
- If you were able to successfully authenticate using Kerberos, you can then use code such as this to connect to the MS SQL database from within a notebook session:
print
statement.