23

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

Community
  • 1
  • 1
WebComer
  • 969
  • 14
  • 27
  • 3
    IDEA does not update available tables automatically - you must toggle it manually after each schema modification by starting "Refresh" action (Ctrl+Alt+Y). – ice Sep 06 '12 at 11:26
  • 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. – WebComer Sep 06 '12 at 11:48
  • 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&tables – WebComer Sep 06 '12 at 12:07
  • ![Valid XHTML]("http://postimage.org/image/7d4vfbs2f/) here ![Valid XHTML][] – WebComer Sep 06 '12 at 14:19
  • ![Data Source properties][]("http://postimage.org/image/by48bh8m1/) – WebComer Sep 06 '12 at 14:28
  • ![ds properties]("http://s7.postimage.org/odnro053t/idea_ds_properties.png") – WebComer Sep 07 '12 at 16:40
  • 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. – WebComer Sep 10 '12 at 09:28
  • Please report this problem with all the details at http://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. – CrazyCoder Sep 12 '12 at 14:36
  • I have the same problem. This is my config for hsqdb: JPA see all my stored data throw sessions. But Data Sources doesn't see any new table (i have spamed "refresh" button too). – Kinjeiro Jan 06 '13 at 19:02

2 Answers2

15

I had the same problem in IntelliJ IDEA 15.

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

Kevin Van Ryckegem
  • 1,791
  • 3
  • 20
  • 48
  • 2
    Worked for Idea 15.0.3 and Postgres 9.5 (though the IDE says it is not recommended to use the legacy introspector) – Matias SM Feb 16 '16 at 13:31
  • Worked for me too. Before the flag I cannot see some columns in the tables I can access – Alberto Jun 29 '16 at 11:01
  • 3
    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. – Haimke Sep 26 '16 at 08:06
5

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.

Kinjeiro
  • 879
  • 11
  • 10
  • +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. – Mercious Jul 04 '19 at 10:23