Print

Connecting with your database

The host of a database query stores vital information about the database connection. With this information, you can interact with the database effectively. Below, we outline the key details you need to configure for a successful database connection.

  1. Database Type: The type of the database you want to connect to. This could be MySQL, PostgreSQL, SQL Server, or any other supported database system we’re showing in the menu.
  2. Hostname or IP Address: The address at which your database server is located. This is crucial for establishing a network connection.
  3. Port: The port number on which the database server is listening. Different database systems often use specific default port numbers.
  4. Credentials: This includes the username and password required to access the database. These credentials must have the necessary privileges for the operations you intend to perform. Take note that you have sufficient rights to the database. When you are allowed to drop databases from the user account, you can also in JOSF. Be aware and notified about that.
  5. Database Name: The name of the specific database you want to interact with. This is essential when dealing with multiple databases on the same server.
  6. Display Name: A user-friendly identifier for your database connection. It helps you easily locate and manage your database configurations.

Connecting to the Database

After providing these database connection details, you should follow these steps to ensure a successful connection:

  1. Test the Connection: This step is crucial to verify that your connection details are accurate and that the database server is reachable. It helps identify any connectivity issues early on.
  2. Save the Configuration: Once the connection is successfully established, make sure to save the configuration. This ensures that you can easily access and reuse this database connection in the future.

Creating a Database Query

Now that you’ve successfully connected to the database, you can proceed to create a query. Follow these steps:

  1. Add Query Model: Start by clicking on “Add Query Model.” This is the initial step in defining the query you want to execute on the database.
  2. Define Query Details: Within the query model, you need to specify three key pieces of information:
    • Query Title: Give your query a descriptive title. This title should provide a quick overview of what the query does.
    • Query Description: Provide a detailed description of the query’s purpose and the expected outcome.
    • Query Statement: This is where you define the actual database query. You can write any SQL query that is relevant to your database type. It is also possible to use input variables. Add one with the button, give it a name and use it in the query using the syntax you’re familiar with ${variable}. (https://www.josf.nl/josf-docs/page-actions/)

Remember that the complexity and structure of your query will depend on the specific database system you’re working with. Be sure to adhere to the syntax and best practices of that particular system.

With these details in place, you can efficiently manage and execute queries on your connected database.
For more detailed and visual explanation please refer to our tutorial video: https://www.josf.nl/josf-docs/tutorial-query-database-modelling/

In this document