Setting up IDEA
Intellij IDEA knows how to work with databases no worse than Workbench. It even has a dedicated Database tab in the right pane. If you click on it, you will see a picture:
Let's try to connect to our database. To get started, click on the plus sign:
How do you like the list of supported databases? Impressive? Starting from Google Big Query and ending with Cassandra.
Connecting MySQL IDEA
But we are modest people, so we'll just choose MySQL. IDEA immediately suggests specifying the settings for connecting to the database:
There are even more of them than Workbench. Although everything you need is already indicated, maybe there is no login and password.
From the interesting: IDEA is written in Java, so it uses standard Java drivers to work with MySQL. That is, exactly those that our program will use when it sends queries to the MySQL server.
Therefore, feel free to click Download to download the missing drivers.
I also specified the login and password for our local server and then clicked on the Test Connection button:
The connection was successfully established, so feel free to click OK.
Displaying the contents of the database
If you see this picture:
Then click on the place highlighted in red and select the list of schemes manually. I specified 3: test, test2 and supershop and this is what I see now:
All three of my diagrams are in place. Let's see what we have in the user table:
Well, I already knew what columns we have there, but how to see the data?
Display table content
I just double clicked on the table name and IDEA showed me this:
So far, it looks much more interesting than in Workbench. The data was immediately displayed, and besides, there are service fields WHERE and ORDER BY. So that you can filter and sort data right on the spot.
Let's try to sort our table by level...
As soon as I started writing the word level, IDEA immediately offered me a great list of hints:
Perhaps it looks more interesting than working through Workbench, he didn’t give out any special hints.
I typed level, hit enter, and voila, the table is sorted:
Okay, now I want to execute an arbitrary query without binding to a table, where can I do it?
We return to the panel on the right - there is a special button there to open the Query Console:
And we start writing a query:
Auto tips from IDEA, as always, on top . And here is the result of our query:
GO TO FULL VERSION