The following is an explanation of how to configure a local SQL Server or PostgreSQL database for prototyping and connect it to GeneXus Next running in a container.
- Open SQL Server Configuration Manager.
- Navigate to SQL Server Network Configuration and click on the arrow > located to the left of its name to expand the section. This will display the available protocols for your SQL Server instance, such as Protocols for MSSQLSERVER.
- In the list of protocols in the right pane, make sure that TCP/IP has the status Enabled. If it is not enabled, right-click on TCP/IP and select Enable.
- Right-click on TCP/IP and select Properties. Next, navigate to the IP Addresses tab. In the IPAll section, configure the following:
- TCP Dynamic Ports: Leave this field empty if you want to specify a fixed port.
- TCP Port: Enter the desired port number, such as 1444.
- Once you've made the changes, click on Apply to save them.
- Open the Services application on your computer. Locate your SQL Server instance in the list of services. For example, in the image, it is labeled as SQL Server (MSSQLSERVER). Right-click on the SQL Server instance name, and from the context menu, select Restart.
- Open Microsoft SQL Server Management Studio (SSMS) and connect to your SQL Server instance.
- In the Object Explorer, right-click on the root node (your server instance name) and select Properties. Navigate to the Security page in the left-hand menu. Under Server Authentication, select SQL Server and Windows Authentication mode. Click on OK to save the changes.
- Open the Services application on your computer. Locate your SQL Server instance (For example, SQL Server (MSSQLSERVER) or SQL Server (SQLEXPRESS2022)). Right-click on the service and select Restart.
- Return to SSMS after restarting the SQL Server service. In the Object Explorer, expand the Security folder and right-click on Logins.
- Select New Login to open the Login – New dialog, and configure the following settings in the General section:
- Login name: Enter the desired username (e.g., GXlogin).
- Select SQL Server authentication.
- Password: Set a secure password and confirm it by re-entering the password.
- After creating the login, navigate to the Server Roles section in the Login – New dialog. Assign the required server-wide roles by selecting the corresponding boxes. In this case, select the roles dbcreator, public, and serveradmin.
- After creating the login, navigate to the User Mapping section in the Login – New dialog. Select the boxes next to the databases where the user should have access. For this setup, select master and model.
- Assign the following database roles for master:
- db_datareader
- db_datawriter
- db_ddladmin
- public (default role, always selected)
Click on OK to save the configuration.
In GeneXus Next, go to the PREFERENCES window, and select the Default Data Store. Next, set the following properties:
- Database Name: (Your Database Name)
- Server Name: host.docker.internal
- Server TCP/IP port: 1444
- Used trusted connection: No
- User ID: (Your New User)
- Password: (Your New User's Password)
Notes:
- 'host.docker.internal' always refers to the Docker host machine (localhost)
- Port 1444 is used to avoid conflicts with the default SQL Server port (1433) used by the sql-1 container
In GeneXus Next, go to the PREFERENCES window, and select the Default Data Store. Next, set the following properties:
- Database: (Your Database Name)
- Server Name: host.docker.internal
- Server TCP/IP port: 5432
- User ID: postgres
- User Password: admin
Notes:
- The 'host.docker.internal' address allows the GeneXus container to communicate with the PostgreSQL container on the host machine.
- Port 5432 is the default PostgreSQL port.
- Ensure your firewall allows connections on this port.
- If you plan to use the Embedding data type in your GeneXus Next applications, you need to set up a PostgreSQL database.
Troubleshooting:
- If the connection fails, check if the PostgreSQL container is running using docker ps.
- Verify that the port mapping is correct in the Docker run command.
- Ensure no other services are using port 5432 on your machine.
Getting Started with GeneXus Next - Generating and running the application