Database cannot be opened! (SQL Authentication Error)

Database cannot be opened! (SQL Authentication Error)

When opening zenon, one may encounter the following message in the output window:



Taking a glimpse at the logs reveals that there are authentication errors regarding zenon's default database user "zenOnSrv". Therefore, no projects can be opened.



There are two possibilities for this scenario:
1. The user credentials entered in the zenon startup tool do not match the SQL credentials of the user in the database
2. The default user 'zenOnSrv' is missing in the database.

To check either, install Microsoft SQL Server Management Studio (SSMS). The setup can be found within the zenon .ISO under /AdditionalSoftware/Microsoft SQL Server Management Studio

 

Run the setup. Once it's complete, start SSMS.
A dialog window will come up asking you to connect to a server.

By default, zenon 14 uses the database server "ZENON_2022" due to a recent switch to SQL 2022.
The previous versions (10, 11, 12) use SQL 2019, and therefore, use the database server "ZENON_2019".

Use Windows Authentication as your authentication method. This way you will log in using your Windows User credentials.
Click Connect to continue.



You can also select your database server via the dropdown menu. If the server for your zenon version is not listed, enter it via the following syntax:
HOSTNAME\DATABASE_NAME (e.g.: MYPC\ZENON_2022)

To get the hostname of your machine, open CMD and type in "hostname".



Once you're logged in, navigate to the Object Explorer on the left side of your screen.
The Object Explorer displays directories, database instances and users stored on the database server.

Navigate to the following directory Security > Logins:



A list of every user instance stored will be displayed. Look for the zenon default user "zenOnSrv".

From here on out, there are two possible causes:

Cause 1: Wrong credentials
If there is an instance to be found, either double-click on the instance or right-click on the user and select Properties to edit it.



Enter a new password and click OK to apply the changes made to the user.



Open the zenon Startup Tool. Select Profile > Edit Profile... to make changes to your zenon profile.

Please make sure to register the zenon version where this scenario occurs first. If you have multiple versions of zenon installed and do not register the correct version beforehand, you may edit the credentials for a different database server and lock yourself out!



Select the Tab Database. Enter the new password you had previously given to the SQL server. Click OK to apply changes.



Cause 2: User instance "zenOnSrv" is missing
If the user is missing, we can create a new one in SSMS.

NOTE: If a zenOnSrv user instance is present, you can also use this procedure to check if the instance has all of the following attributes in place.

Right-click to bring up the context menu and select "New Login...".

Enter a new username and password. In our case, we will name the instance "zenOnSrv". You can also give the user a different name, but make sure that the credentials match.
Also, make sure that "master" is set as the default database and English as the default language.



On the left side of the dialog window, the settings for the instance are displayed.
Move one page down to Server Roles.

Select the following roles:



Next, we move onto User Mapping.
Here you'll find databases you can map your user to.

Your user must be mapped to "master""model" and "tempdb".

For each database, the following role memberships must be selected "db_owner" and "public". 



Heading one page further down to the Securables, your database server must be available as an object instance.
Add an instance by clicking on Search... 

A dialog window will come up, asking you to select an object. Select your database server and click OK.



Now that your server has been added as an instance, scroll down to the permissions.
The permission Connect SQL must be granted to your user, with the Grantor being "sa".

Preview

On the final page, select both Grant and Enabled to allow your user to connect and login into the Database.



With our user now being created and all set up, head into the Startup Tool, referring back to the first possible cause, and select Profile > Edit Profile... to make changes to your zenon profile. 

Preview

Select the tab Database and enter your new user credentials.

Preview

zenon should now be able to open the database again and load in your projects.