> ## Documentation Index
> Fetch the complete documentation index at: https://docs.domino.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to IBM Netezza

You can connect to IBM Netezza using a Data Source or directly.

## IBM Netezza Data Source

Your [administrator must create a Data Source for this data store](/cloud/admin/data-administration/external-data/config-starburst-data-sources#create-a-starburst-jdbc-powered-data-source) for you to use.

After your administrator has created the Data Source, you can work with it in your project as usual.

## Direct connection

Connect directly to [IBM Netezza](https://www.ibm.com/products/netezza) from Domino. You must have network connectivity between Netezza and your Domino deployment.

<Warning>
  Domino does not officially support this method. We provide this information as a courtesy.
</Warning>

## Python and nzpy

Domino recommends the [nzpy](https://pypi.org/project/nzpy/) package for interacting with Netezza from Python.

### Environment setup

Use the following Dockerfile instruction to add [nzpy](https://pypi.org/project/nzpy/) to your environment.

This instruction assumes you already have [pip](https://pypi.org/project/pip/) installed.

```dockerfile theme={null}
RUN pip install nzpy
```

### Credential setup

You must set the following Domino environment variables to store secure information about your Netezza connection

* `db_username`

* `db_password`

See [Store Project credentials](/cloud/platform-capabilities/core-concepts/projects/configure-projects/store-project-credentials) to learn more about Domino environment variables.

### Usage

See the [nzpy docs](https://github.com/IBM/nzpy) for detailed information about how to use the package. The following is an example for connecting to Netezza with nzpy where:

* You have set up environment variables noted above with the `db_username` and `db_password`

* You’ve replaced `my.host.name` with the host name for your machine

* You’ve replaced `my.database.name` with the database name for your machine

```python theme={null}
import nzpy
import os
import pandas as pd

hostname = 'my.host.name'
database_name = 'my.database.name'
port = 5480
username = os.environ['db_username']
password = os.environ['db_password']

def query_db(sql):
   conn = nzpy.connect(user=username, password=password, host=hostname, port=port, database=database_name)
   with conn.cursor() as cursor:
      cursor.execute(sql)
      df = cursor.fetchall()
      return df

sql_cmd = """

SELECT
 *
FROM
 table

"""

df_cmd = query_db(sql_cmd)

df_cmd
```

## R and RJDBC

Domino recommends the RJDBC package and nzjdbc jar for interacting with Netezza from R.

### Environment setup

Use the following Dockerfile instruction to add RJDBC to your environment.

```dockerfile theme={null}
RUN R -e 'install.packages("RJDBC")'
```

### Credential setup

You must set the following Domino environment variables to store secure information about your Netezza connection

* `db_username`

* `db_password`

See [Store Project credentials](/cloud/platform-capabilities/core-concepts/projects/configure-projects/store-project-credentials) to learn more about Domino environment variables.

### Usage

Test if the `nzjdbc` jar is working as expected by running the below in a workspace terminal

`java -jar <path.to.the.nzjdbc.jar> -t -h my.host.name -p 5480 -u <username> -db <database_name>`

The following is a simple example for connecting to Netezza with RJDBC and `nzjdbc` jar where:

* `nzjdbc` jar is present in the project files (`/mnt/nzjdbc3`)

* You have set up environment variables noted above with the `db_username` and `db_password`

* You’ve replaced `my.host.name` with the host name for your machine

* You’ve replaced `my.database.name` with the database name for your machine

```R theme={null}
library(RJDBC)
drv <- RJDBC::JDBC(driverClass = "org.netezza.Driver", classPath = "/mnt/nzjdbc3.jar")
conn <- dbConnect(drv, 'jdbc:netezza://my.host.name:5480/my.database.name;logLevel=2',Sys.getenv('db_username'), Sys.getenv('db_password'))
dbListTables(conn)
```

## Next steps

* After connecting to your Data Source, learn how to [Use Data Sources](/cloud/platform-capabilities/core-concepts/data/data-source-connectors/use-data-sources).

* [Share this Data Source](/cloud/platform-capabilities/core-concepts/data/sharing-and-security/share-data-sources) with your collaborators.
