Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 463
Ziast Avatar asked Feb 14 '17 16:02

Ziast


People also ask

How add SQLite Database to PyCharm?

Professional feature: download PyCharm Professional to try. ) and select SQLite. At the bottom of the data source settings area, click the Download missing driver files link. As you click this link, PyCharm downloads drivers that are required to interact with a database.

How do I add a Database tool in PyCharm?

Open the database tool window View -> Tool Windows -> Database> and open the dialog called Data Sources and Dialog. Now, select MySQL database for adding a new data source.

How do I view a DB file in PyCharm?

In the Database tool window (View | Tool Windows | Database), you can work with databases and DDL data sources. You can view and modify data structures in your databases, and perform other associated tasks. To view a table, double-click the table. For more information about different viewing modes, see View data.


1 Answers

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.

like image 177
Stévillis Avatar answered Sep 22 '22 06:09

Stévillis