Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I open a sqlite db file in my local disk in intellij 13 preview

I can see the db file in the left pane of intellij but when I double click the file, nothing is opened. Also, I am on a trial of ultimate edition.

like image 435
Fermat's Little Student Avatar asked Nov 09 '13 02:11

Fermat's Little Student


People also ask

How open SQLite file in Intellij?

Open the Database tool window by selecting View | Tool Windows | Database from the main menu. on the toolbar and select Android SQLite from the drop-down menu. In the Data sources and drivers dialog that opens, specify the following: The name of the data source.

How do I open local SQLite?

Open a command prompt (cmd.exe) and 'cd' to the folder location of the SQL_SAFI. sqlite database file. run the command 'sqlite3' This should open the SQLite shell and present a screen similar to that below.

How do I view a .DB file?

Open an Access database from Windows ExplorerIn Windows Explorer, navigate to the drive or folder containing the Access database file you want to open and double-click the database. Access starts and the database is opened.

How do I open data sources and drivers in Intellij?

To access the Data Sources and Drivers dialog ( Shift+Enter ), perform one of the following actions: In the Database tool window (View | Tool Windows | Database), click the Data Source Properties button. . In the Database tool window (View | Tool Windows | Database), click the Add button.


1 Answers

An SQLite database is not a simple file that can be opened via a double click. To access a database, a Database driver needs to be defined to be used with the file. Here's how you can configure the database for use:

  1. Open the Database tool window (On the right side by default, or View> Tool Windows > Database)
  2. Use the add icon drop down to select SQLite and the driver you want to use enter image description here
  3. If this is the first time you have configured an SQLite database, you will need to configure the driver first.
    • Drivers can be defined globally, and then used by a database definition; or
    • Drivers can be defined per database definition.
    • Since you can define multiple global drivers (different versions for example), the first option is generally the best/easiest
  4. Expand the Drivers node in the left pane and drill down to the driver you are using
  5. You can either have IntelliJ IDEA download an appropriate driver JAR file, or you can define one using a jar in your file system. For example, I simply point to the JARs in my local Maven repository to define drivers. enter image description here
  6. Click the Apply button so that the newly defined driver will be available in the database configuration. enter image description here
  7. Navigate back to your SQLite configuration in the left pane
  8. By default, the Driver Files pane will now be collapsed. You can expand it if desired to see that it is using the global driver definition. Again, if desired, you could define a one off driver definition here.
  9. Select or enter the path to the SQLite database file
  10. Give the database a name
  11. Select if the database will have project or IDE (global) scope (i.e. availability)
  12. You can override the JDBC URL if needed, but the defaults – which gets populated once the driver and the database file are defined -- should work
  13. Set if the database should automatically sync (i.e. check for external changes) and if it should be read only. enter image description here
  14. Click Test Connection – you should get version information. enter image description here
  15. If desired, on the Schema & Tables tab you can set filters so only certain schema or tables are visible. You can also define the default schema. Click the Help button for more information
  16. Once you have the database defined, you can expand it in the database window and drill down
    • If you open the context menu (i.e. right click or the context menu key) on a table, you can open a table editor where you will see (and can edit) the tables content. (there’s also a edit table button in the database tool window’s tool bar)
    • On the context menu is also an option to open a console. You can enter SQL commands and then execute them (there is also a console button in the database tool window’s tool bar). IDEA does provide code completion for the database when editing SQL statements in the console or code.
    • Note that if any changes (especially structural changes) are made externally, and you did not select auto-sync in the configuration, you will need to re-sync the database to see those changes. There’s a sync button in the database tool window.
  17. The last thing you will want to do is go to Files > Settings > [Project Settings] > SQL Dialects and set the SQL dialect for the project to SQLite. This way IDEA will know which syntax to favor when doing code completion and error checking.
like image 114
Javaru Avatar answered Sep 20 '22 10:09

Javaru