sqlitestudio icon indicating copy to clipboard operation
sqlitestudio copied to clipboard

[20:04:42] Cannot execute query on undefined or invalid database.

Open LRD1001 opened this issue 3 years ago • 4 comments

Details

Here you describe your problem details, or proposal for enhancement.

Steps to reproduce

This applies only to bug reports. If this is a feature request, delete this section.

Operating system

This applies only to bug reports. If this is a feature request, delete this section.

SQLiteStudio version

This applies only to bug reports. If this is a feature request, delete this section.

LRD1001 avatar Mar 06 '21 19:03 LRD1001

Please provide more details.

pawelsalawa avatar Mar 07 '21 20:03 pawelsalawa

I got this error when the database was disconnected and I tried to execute a query. While in my situation it was duh! I also noticed that when you "Add a database" it adds the database, but the database is disconnected! It seems like when I add a database, it should automatically connect to it. After all I wouldn't be adding it, if I didn't intend to use it. Second thing I noticed is that when you have no databases or a disconnected databases, then you cannot execute:

SELECT 2 * 2 ;

which isn't dependent upon any database. However, I do understand that in order to run any SQL you need to run it using some schema. The solution to this might be to always initialize the application with an empty memory database and connect to it when no database was given on the command line of the application, then you could do the above SQL which isn't dependent on a database without getting an error.

FYI, you can create a shortcut ...\SQLiteStudio\SQLiteStudio.exe ":memory:" in Windows to always create an application instance with a memory database.

houghtonap avatar Apr 13 '21 22:04 houghtonap

Somewhat related: #4064

pawelsalawa avatar Nov 16 '22 20:11 pawelsalawa

if using sqllite make sure your connected to the database

muyobo1 avatar Feb 26 '24 22:02 muyobo1