Unless you're either using a local database or a backend server, you shouldn't choose either.
My recommendation would be having a NodeJS API on the backend that connects to the database and Electron connects to the API. Never give the database connection data to the end user, unless it's a planned move and it's to use on a local database.
I can recommend Sequelize because what I'm use the most on every project I need to create database connections. It supports TypeScript, and if you already have the database create you can use sequelize-auto to create the models, as easy as that.
I've only used Electron once and I liked it, but it's not a good comparison, since it doesn't offer any database access by default. I used React for the frontend part of the app, you can use whatever you want.
