Ziast
Ziast

Reputation: 83

Setuping DB Navigator(SQLite) for PyCharm

I have not been having luck setting up a connection to SQLite3 through DB Navigator. I have read over the documentation, but it seems to be out of date and doesn't explain how to actually set up a connection. My set up screen doesn't even look like what is pictured in the docs. The built int help doc just errors and says it can't find the document.

When I try to test the connection, I get the error "Database information incomplete or invalid (host, port, database, file)". I have tried host = localhost, port=22(default). There is the option to enable 'Use SSH' but disabling doesn't change the result. There are fields for Username, and Password. I'm not sure what they want in there. Currently I have 'system' and a random password.

Database file(a single field) is the path to the dir that the database is in. The field 'main' I have the name of the database file itself. Driver Source is the default of built-in library.

What fields am I missing or have in wrong? I can connect to this through VS with both SQLite and SQL server, but not PyCharm.

EDIT:

Finally figured it out. Single SQLite has no username or password capability, I needed to leave all of that disabled. In the database field I browsed and navigated to the file and selected the whole file instead of just the dir. The Main field was left empty.

Upvotes: 6

Views: 8584

Answers (2)

stramin
stramin

Reputation: 2390

I just solved this issue saving the database file in a different folder, it seems like the problem are the space characters (and maybe other special characters) on the path.

For example something like C:\Users\Wile E Coyote\Acme Files\MyDataBase doesn't work, but something like C:\Users\RoadRunner\Beep\MyDataBase works.

Upvotes: 1

Stévillis
Stévillis

Reputation: 491

I figured out that the plugin has a bug.

Step 1 - To connect to the databases you need to enable Auto-Commit and Connect Automatically in DB Navigator.

Step 2 - In DB Navigator > Settings > Database files, you need to add the database file's name, to click in the green add button and then press Enter.

If you still get the error but the connection was succesfully, don't worry, it's just a bug.

But if you get the error and you database connection it's not working, you must follow the Step 2 again, but now change the database file's name path, without include the name of the file and press Enter. Open DB Navigator > Settings > Database files again and now put the database file's name, to click in the green add button and then press Enter.

I've read about this problem in 2014, but nowadays this problem is still alive. Maybe, when you put the paths, there's no refresh in the database file's path and the connection can not be established.

Upvotes: 4

Related Questions