[Solved] Unable to resolve table name

Answered

Hello,

I use PHPStorm 2019.3.2 and I have a problem related to SQL queries inside my PHP scripts. I created a Database connection inside Database tool window and it seems working fine, I tested the connection and it works fine and I see all the tables I want to work with. The problem is that the editing window report the "Unable to resolve table name" in all of the espression inside my PHP code that contain an SQL query, as it can see in the picture below

For example, If I go with the mouse on "SELECT * FROM question" I get an error message, but the connection to the database seems ok, as it can see the window to the right.

Also if I try to use the SQL console, all the autocompletion and suggestions in both SQL syntax and table or column names work fine, as in the picture below.

I already tried some suggestions in this forum or in StackOverflow, but nothing helped.

Any suggestions?

Thanks

Alessandro

11 comments
Comment actions Permalink

Hi there,

Make sure that correct SQL Dialect is used -- you may have it set to MySQL instead of MariaDB for the project folder.

See this similar (as for me) thread: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360007017959/comments/360001311360

10
Comment actions Permalink

Thank you,

now it works, the problem was the SQL Dialect.

2
Comment actions Permalink

I had to change my SQL Dialect from MySQL to MariaDB

2
Comment actions Permalink

I had the same issue on 2020.1 version.

all solutions above didn't help me. 

my solution is to fill in database field in data source config

8
Comment actions Permalink

I had the same issue in 2020.1.1 as Alexey above and that solution fixed my problem.

0
Comment actions Permalink

Intellij idea 2020.1.1

On my side, the issue is still present. and I can't find `data source config` as Alexey says above.

Where is it located?

 

0
Comment actions Permalink

Please try the following way:

6
Comment actions Permalink

Oh, yeh. It works for me with external DB. 
I tried it with MySQL.

Currently, I have this issue with local SQLite DB.

and for it I can't configure this field.

Thank you for your example.

0
Comment actions Permalink

@Lo Ka

>Currently, I have this issue with local SQLite DB.

>and for it I can't configure this field.

Please check what schema is selected in Schemas tab & perhaps SQL Resolution Scopes settings page.

Check this comment for bit more info: https://intellij-support.jetbrains.com/hc/en-us/community/posts/206363599/comments/360001695700

1
Comment actions Permalink

Andriy Bazanov
I found it in settings

File | Settings | Languages & Frameworks | SQL Dialects

Thank you.

For me, the issue is solved.

2
Comment actions Permalink

I ran into the same problem,and it worked.Thank you!

0

Please sign in to leave a comment.