# Exception: "org.appvance.hibernate.exception.GenericJDBCException: Cannot open connection"

Exception may appear in error logs within a controller while executing a Database Scenario

This topic assumes you are capable of creating sql scripts in MYSQL or other similar, as well as capable of creating Scenarios using Appvance UTP.

1. Grant all the privileges for the database user you are logged in as.
2. Execute the query below to resolve the aforementioned exception: GRANT ALL PRIVILEGES ON (database name). (table\_name) TO ‘ user’@‘localhost’ WITH GRANT OPTION;
3. In the event you are creating new database and new user, execute the query below to grant necessary privileges:  
    Ex:create a database "Apptest" with table name test  
    create a user and grant the privileges:  
    CREATE USER 'apctest1'@'localhost' IDENTIFIED BY 'apctest1';  
    CREATE USER 'apctest1' IDENTIFIED BY 'apctest1';  
    FLUSH PRIVILEGES;  
    GRANT SELECT, EXECUTE, SHOW VIEW, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, LOCK TABLES, UPDATE, REFERENCES, INSERT, INDEX, DROP, DELETE, CREATE VIEW, CREATE TEMPORARY TABLES ON `apctest1`.\* TO 'apctest1'@'localhost' WITH GRANT OPTION;  
    GRANT SELECT, EXECUTE, SHOW VIEW, ALTER, ALTER ROUTINE, CREATE, CREATE ROUTINE, LOCK TABLES, UPDATE, REFERENCES, INSERT, INDEX, DROP, DELETE, CREATE VIEW, CREATE TEMPORARY TABLES ON `apctest1`.\* TO 'apctest1'@'%' WITH GRANT OPTION;  
    FLUSH PRIVILEGES;  
    GRANT ALL PRIVILEGES ON Apptest.test TO ‘apctest1’@‘localhost’ WITH GRANT OPTION;  
    where
    - Apptest - Database Name
    - test - Table\_name
    - apctest1 - User of the example database/table and user that was created.

---

## Connection troubleshooting

Check the database host, port, schema, credentials, and MySQL account host pattern before changing grants. Use the least privilege required by the database scenario; the broad `<span class="editor-theme-code">GRANT ALL PRIVILEGES ... WITH GRANT OPTION</span>` statements shown here are administrative examples and should not be copied into production without review. Confirm the user can connect from the AIQ execution node and then rerun the scenario.

Last updated: October 15, 2026

If you have any feedback on this topic, please contact us at <documentation@appvance.ai>