# Database URLs ## What is a Database URL? The `Database URL` is the connection string of a database. By default in Mitto it is the local database (`postgresql://db/analytics`). The structure of database connection strings is as follows: `{driver}://{username}:{password}@{server}:{port}/{database}?{parameters}` ## Common database drivers | DBMS | Driver | |---|------- | | Amazon Redshift | redshift+psycopg2 | | Google BigQuery | bigquery | | IBM | DB2db2+ibm_db | | MariaDB | mysql+pymysql | | MySQL | mysql+pymysql | | PostgreSQL | postgresql | | SQL Server | mssql+pyodbc | | Snowflake | snowflake | ## Parameters | DBMS | Parameter | |--|--| | SQL Server | ?driver=ODBC+Driver+17+for+SQL+Server | | Snowflake | ?warehouse={warehouse} ## Encrypted Credentials In most database url strings, you are required to pass a username and password through the string. Mitto's [Credential manager](/user-interface/index.html#credentials) is a way to encrypt and store credentials to that they don't need to be explicitly included in the database url string. To use saved credentials: Navigate to the Credential manager via the Mitto UI. .. image:: assets/database_urls__credentials.png :alt: Mitto Credential Manager image Select **Add Credentials** and from the dropdown choose `Basic` Credential type. Give the credential an easy to use name like "mysql" or "psql". Fill in the `username` and `password` input with the database credentials. **SAVE!** .. image:: assets/database_urls__basic_creds.png :alt: Mitto Basic Credential Next, create a **Query** job from the **Add Job** menu. On the **Connect** screen, deselect **Use default database URI** which should expose and input for **Database URL**. Input the Database URL string associated with the type of database you are connecting to and use the Credential Name created in the previous step instead including them in the string. For example, if you are trying to query a PostgreSQL Database, the string would look like `postgresql://psql@/` Check the **Use credentials** box and it should expose a dropdown selector. This is where you will selected the saved credential from the previous step. Lastly, write your desired [query in the query input window](/jobs/query/). .. image:: assets/database_urls__connect.png :alt: Connect to database .. NOTE:: In order for Mitto to access most databases, it will likely need to have access via it's IP address or some other security mechanism implemented by your organization. Contact IT to determine the best way to allow Mitto access to the source database. To get the IP address of your Mitto instance, use your command line and run `nslookup ` . Based on the example above you would run `nslookup zuar.net` Once you've completed the Wizard for the Query job. The input section of the JSON configuration will look something like: ``` json input: { use: query.io#QueryInput query: SELECT * FROM demo.test_orders; dbo: postgresql://psql@zuar.net/analytics stream_results: 50000 credentials: psql } ```