This article will walk you through the steps needed to setup your database credentials, configure a database connection, and then create a reusable query.
Setup Database Credentials in Stackify
To connect to your database, first you need to setup the credentials that you will use to connect.
Note: In the case of Oracle, the user executing the query needs additional access to the PLAN_TABLE to run the query through Stackify.
Add a New Password to the Vault
Navigate to Settings > Passwords > Click 'Add new record' button Find out more about Passwords: Security: Passwords
Add Database Credentials
These credentials are the login credentials that will be used when connecting to the database, so verify that the credentials match the connection string and that the user you are using has the appropriate permissions to the database.
Note: When entering your credentials for SQL Server, you must the same credentials as the SQL Server Authentication mode when accessing the local SQL Server database. (Windows Authentication mode is not supported).
Configure a New Connection
Now we will walk through setting up a new connection to an existing database, utilizing the credentials that you have setup already.
Go to SQL Query Monitor Page
Go to Connections
Click Add New
Here you can specify the database server type where your database is located.
Note: PostgreSQL and MySQL connections are only supported with Linux agents, while SQL Server connections are only supported with Windows agents.
- Enter Database Details
You will need to know the server address, which credentials to select, and the default database to utilize when executing a query. Once you have entered these details, this connection will be saved and available for use in executing queries later.
Create a New Query
Under Database, in the Query page, you will click New Query to build a new query from scratch.
Configure the Query
You will select a previously configured Connection (which may have a default database that you can override), and provide the query. The query can only be a SELECT query, as others will be rejected.
Note: For security purposes, SQL queries cannot be validated within Stackify. We recommend validating the SQL Query locally first. Then you can go here to see how to create monitors for your queries.