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

7

27

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

Niersteiner answered 6/9, 2012 at 10:56 Comment(10)
IDEA does not update available tables automatically - you must toggle it manually after each schema modification by starting "Refresh" action (Ctrl+Alt+Y).Rig
yes, i've tried both now and before - yet no luck. can add any table from scheme in several db's in idea- but the one i did myself.Niersteiner
i even created new scheme in idea sql console, marked it to see - no luck! mysql workbench sees it, but idea doesn't, refresh main list in window - no luck. but it sees the schemes in datasource properties schemes&tablesNiersteiner
![Valid XHTML]("postimage.org/image/7d4vfbs2f) here ![Valid XHTML][]Niersteiner
![Data Source properties][]("postimage.org/image/by48bh8m1)Niersteiner
<img src="postimage.org/image/by48bh8m1">Niersteiner
![ds properties]("s7.postimage.org/odnro053t/idea_ds_properties.png")Niersteiner
i’ve successfully created schema, db and table with the db tool from idea, but they don’t want to appear in the table list in data sources. Anybody, please - do you have an idea why? The user was standard root with all the privileges.Niersteiner
Please report this problem with all the details at youtrack.jetbrains.net/issues/IDEA so that our developers can reproduce and fix it. So far the behavior you've described is not reproducible with the same MySQL and JDBC driver versions. It may help if you attach your database to the issue.Soluble
I have the same problem. This is my config for hsqdb: <property name="hibernate.connection.url" value="jdbc:hsqldb:file:db_file/testDBInMemory;shutdown=true;hsqldb.write_delay=false;"/> JPA see all my stored data throw sessions. But Data Sources doesn't see any new table (i have spamed "refresh" button too).Bra
O
15

I had the same problem in IntelliJ IDEA 15.

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

Ostap answered 30/11, 2015 at 20:54 Comment(3)
Worked for Idea 15.0.3 and Postgres 9.5 (though the IDE says it is not recommended to use the legacy introspector)Rodmann
Worked for me too. Before the flag I cannot see some columns in the tables I can accessGracye
Worked for me as well. Although my path was not exactly the same. For me: right-click data source -> options -> Introspect using JDBC metadata. Intellij 2016.2.4.Deeannadeeanne
H
8

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

Hessenassau answered 14/11, 2022 at 13:53 Comment(2)
Force Refresh worked for me. Thanks.Protrude
thanks, Force Refresh worked! wasted 2 hours on this...Spooner
B
6

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.

Bra answered 6/1, 2013 at 19:29 Comment(1)
+1. This is the answer and it's still present in 2019.1. What makes it so hard to find is that IntelliJ pretends to have actually connected to a database. Instead it just connected to a non-existent file and then tells you the database is empty.Varro
G
0

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.

Geothermal answered 20/7, 2021 at 19:59 Comment(0)
J
0

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

Junoesque answered 10/2, 2024 at 8:59 Comment(0)
E
0

A solution that worked for me in 2023.1.3:

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

Edelsten answered 19/4, 2024 at 13:33 Comment(0)
I
0

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.

Integrate answered 8/7, 2024 at 15:48 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.