exalex
exalex

Reputation: 63

eclipse - JPA entities from tables, no schemas listed

I have a database (called "socializer") residing within MariaDB server and I'm trying to generate JPA entities from tables of that database in Eclipse, but cannot, because schema selection is grayed. Any ideas why?

My setup: Eclipse Neon, Eclipse Link 2.5.2, MariaDB 10.1.19-1, Arch Linux.

I know that the connection to my database has been established, because I can see it listed in Data Source Explorer, but its "Schemas" folder is displayed just empty, although it actually contains a few tables, created and perfectly observed within MySQL Workbench (the other listed databases appear to have empty "Schemas" as well).

JDBC connection properties:

Database: "socializer"
URL: "jdbc:mariadb://localhost:3306/socializer"
User name: root
Password: ""

JDBC driver (Generic JDBC Driver, mariadb-java-client-1.5.5.jar) properties:

Connection URL: "jdbc:mariadb://localhost:3306/socializer"
Database Name: "socializer"
Driver Class: "org.mariadb.jdbc.Driver"
User ID: "root"

And yes, user name and password are ok (ping will fail if either of them is changed).

Upvotes: 6

Views: 7971

Answers (5)

Steven Z.
Steven Z.

Reputation: 67

In my case, I'm connecting to MySQL, and the problem is I need to add JDBC driver to Eclipse.

https://www.javahelps.com/2015/08/add-mysql-jdbc-driver-to-eclipse.html

Then when Eclipse asks you to select a connection profile, select the driver you added (MySQL for me, instead of Generic JDBC), and you should be able to see all schemas.

Upvotes: 0

ChillDochMal
ChillDochMal

Reputation: 81

In my case my database name was not case sensitive.

Upvotes: 2

Fakhryan Albar
Fakhryan Albar

Reputation: 113

https://www.eclipse.org/datatools/downloads.php

install this plugin, i use 1.14.1 (Oxygen) version then create new jpa tools, choice mysql

Upvotes: 0

SIDDHARTH KSHIRSAGAR
SIDDHARTH KSHIRSAGAR

Reputation: 49

This Worked For me.... Go to Go to Project -> Properties -> JPA

check both checkboxes

  1. override default catlog from connection --> select ur connection
  2. check default schema for connnection --> select ur schema

and done.. :)

Upvotes: 2

Ruik
Ruik

Reputation: 1353

In Addition to the comments, I found another reason that might cause the problem, that no schema's are listed:

enter image description here

I run into this while trying to connect to another database with other schemas than before.

Go to Project -> Properties -> JPA and disable/uncheck Override default schema from connection

enter image description here

If there is a schema selected that doesn't exist in the selected database, no schemas will be shown when creating entities. For me the problem was, that Eclipse was trying to show a schema from the database before.

Upvotes: 6

Related Questions