WebComer
WebComer

Reputation: 1181

intellij idea data sources doesn't see existing table in the database

intellij idea data sources doesn't see existing table in my mysql database, while Netbeans see it. i've created a table in the database. When i create connection in intellij idea data sources, it sees my scheme, i do select it in "schemas and tables" but then i don't see it in the list. every schema, but mine's. When i try to connect to it with netbeans or mysql workbench, it's just ok. same story with several databases, with root access, too. any table, but mine's. what could be wrong?

i see question like mine's here, related to visual studio, no answer. please, give a good clue

Upvotes: 27

Views: 16090

Answers (7)

Caleb Vaccaro
Caleb Vaccaro

Reputation: 1

Easy answer, Go to "DB Properties" -> "Schemas", and enable the db schemas you want to see. By default, basic schemas like dbo (ex. dbo.users) is not shown. You can either select specific schemas/databases to see or you can select "All Schemas" if you want to see everything (I don't recommend, since there are so many schema types in enterprise databases). Press "Apply/Ok" and you should be able to query basic tables.

Upvotes: 0

lucasrc
lucasrc

Reputation: 1

A solution that worked for me in 2023.1.3:

settings -> Database -> Database Inspector -> Disable the option "Enable Offline Mode"

Upvotes: 0

Vladimir Petrovsky
Vladimir Petrovsky

Reputation: 61

I recommend to delete the "idea" folder.
This will reindex the entire project.

Upvotes: 0

dracuella
dracuella

Reputation: 578

For the latecomers still experiencing this, Intellij IDEA also has the following features which might help you as they have me:

  • 'Force Refresh' (ctrl + shift + F5): "The Force Refresh action clears the data source information from cache and loads it again from scratch."
  • 'Forget Cached Schema' which clears the schema cache. Does require you to set which schema you want shown again.

Right click your datasource -> Diagnostics -> 'Force Refresh' or 'Forget Cached Schema'

Source: https://www.jetbrains.com/help/idea/cannot-find-a-database-object-in-the-database-tree-view.html

Upvotes: 10

Adam Wise
Adam Wise

Reputation: 2260

The answer for me was buried in a comment, so I'm posting it here. The symptom for me was seeing an error like this: Unable to resolve table 'thetablename' And the table name was highlighted in red.

The following fixes are all ways to trigger IntelliJ to refresh data sources:

  • CTRL+ALT+Y to refresh the db stuff, or
  • CTRL+F5, or
  • Click the database vertical tab on the right, expand, right-click on each DB connection and select 'Refresh'

Kudos to @ice for answering this earlier in a comment. I'm basically just elaborating and making sure this shows up as an answer.

Upvotes: 0

Kevin Van Ryckegem
Kevin Van Ryckegem

Reputation: 1945

I had the same problem in IntelliJ IDEA 15.

I fixed it by right clicking the data source -> Properties -> Schemas -> Use legacy introspector.

Upvotes: 15

Kinjeiro
Kinjeiro

Reputation: 917

I found the reason of problem for HSQLDB: There is IDEA bug (i have 11.0 version).

Create db with relative path (relative of MODULE), like this:

jdbc:hsqldb:file:db_file/testDBInMemory;shutdown=true;hsqldb.write_delay=‌​false;
f:\TestModule\db_file\

When added it to Data Sources, IDEA recognizes this path as relative of $IDEA_HOME$/bin folder.

f:\Program Files\JetBrains\IntelliJ IDEA 11.0\bin\db_file\

So you have two different data bases. And when JPA updated first, Data Source doesn't see update in other.

WORKAROUND: use absolute path in file db url.

Upvotes: 6

Related Questions