JPA Structure panel is responsible for everything related to DB configurations. To create a new DB connection, click on the “Plus” button and choose “DB Connection”. To use Reverse Engineering and Database Versioning features, the first thing you will need to do is create a database connection.
For now, JPA Buddy supports following databases:
You can fill the required settings for the connection manually, but if your project contains data source settings in the application.properties file, JPA Buddy can get them and paste into corresponding fields automatically. Click on the “Detect Connections” button in the JPA Structure panel and the window will appear with filled fields.
As the IntelliJ IDEA Ultimate provides a large number of options for data sources configurations, there is no needs to create other connections to make JPA Buddy works. You can learn more about it on the corresponding JetBrains documentation page.
For the IntelliJ IDEA Community edition, JPA Buddy offers a similar mechanism.
Some of the RDBMSs that JPA Buddy supports provide the possibility to create non-default schemas, but not all of them work well with JDBC. That’s why you can face with some known issues during diff generations, or reverse engineering. For now, these issues can only be solved with some workaround. Below are examples of connecting to non-default schemas for all databases supported by JPA Buddy.
The default PostgreSQL schema is “public”. For other schemes you need to specify desired schema name in the Connection params field via “currentSchema” parameter:
The default Microsoft SQL Server schema is “dbo”. To connect to the non-default scheme in Microsoft SQL Server, you should follow the steps described below:
create login JohnDoe with password='saPassword1'
create user JohnDoe for login JohnDoe with default_schema = my_schema
exec sp_addrolemember 'db_owner', 'JohnDoe'
For JDBC the connection setup will look like this:
And for JTDS like this:
In Oracle, schema, user and database are the same thing. Hence To connect to the non-default scheme you need to specify schema name in the user field.
For the connection via SID setup will look like this:
And for the connection via service name like this:
To connect to the non-default scheme you need to specify schema name in the Database URL field:
Since IntelliJ IDEA CE doesn't allow configuring database drives, JPA Buddy is to the rescue! Open Tools -> JPA Buddy -> Database Drivers window. Here you can configure drivers for each supported RDBMS by selecting one of the proposed driver versions and adding additional files from your local machine.
JPA Buddy uses a different mechanism from what IntelliJ IDEA uses to connect to the database. So, JPA Buddy can't use the SSH tunnel configured in IntelliJ IDEA. To make Buddy works properly in this case, you need to establish an SSH tunnel on the system level. Here is an example of how you can do it.