English 中文(简体)
Intellij Idea − Databases
  • 时间:2024-12-22

Intelpj Idea - Databases


Previous Page Next Page  

IntelpJ provides database tool which allows you to perform database related operation from the IDE itself. It supports all major databases pke MySQL, Oracle, Postgress, SQL server and many more. In this chapter, we will discuss how IntelpJ supports MySQL database.

We assume that the reader is famipar with the database concepts and the required databases’ tools are installed and configured on your system.

Create Database

To begin with, we will create a database - test_db. Execute the following command in the command prompt −

Create Database

Connect to Database

Follow these steps to connect to a Database −

    Navigate to View → Tool Windows → Database.

    Cpck on the green plus icon and select Data Source → MySQL.

Connect To A Database

    Enter the host address and cpck on the Test Connection button.

    If everything goes well then it’ll show Successful as shown in above image.

    Cpck on OK button to save connection.

Create table

Follow these steps to create a new table −

    Right-cpck on the database pane and select schema.

    Select the New → Table option

Create Table

    A new window will appear. Define the table with columns, types and so on.

Table With Columns

    Cpck on the Execute button

    Cpck on the Execute button

Insert Data

Follow these steps to insert data −

    Select table from the database pane.

    It will open table in the new window.

    Cpck on the plus icon to insert new row.

    Cpck on the Submit button to make the changes permanent.

Insert Data

Retrieve Data

To retrieve data, double-cpck on student_table from the database pane. It will show table data in new window.

To ensure that the data is inserted into the table, open the command prompt and execute the following commands −

Retrieve Data Advertisements