Sampath Pasupunuri
Sampath Pasupunuri

Reputation: 638

Netbeans - generating entity class from database

I am using netbeans IDE 7.1. I am trying to generate entity classes from a database(sql server). I am able to setup the connection to this remote datasource but in the New Entity Classes from database Wizard the tables are not showing up and at the bottom it says select atleast one table.

I could execute queries and browse through the tables from the netbeans databases service.

Can someone help me to fix this..

Thanks

Upvotes: 8

Views: 19483

Answers (4)

Selvam Raju
Selvam Raju

Reputation: 305

In the newer versions of NetBeans if you create a database connection with default schema, it will take mysql as schema name and generate the connection string.

So goto your DB connection in NetBeans and edit your connection url.

Example :

Change

jdbc:mysql://localhost:3306/mysql?zeroDateTimeBehavior=CONVERT_TO_NULL

to

jdbc:mysql://localhost:3306/YOUR_SCHEMA_NAME?zeroDateTimeBehavior=CONVERT_TO_NULL (add your schema name in the connection string and save)

Upvotes: 1

nettie
nettie

Reputation: 692

I had to go into Glassfish console and create a special connnection pool and resource. The connection pool had to be res-type="java.sql.Driver" (not datasource). Then when creating my entity, I picked this new resource from the list and it worked, my tables showed up.

Upvotes: 0

Yusuf1494
Yusuf1494

Reputation: 352

maybe your schema is not selected correctly, check on service windows->database->your connection(the bold schema is a default selected schema) if it wrong, right-click->properties, and change your schema to public, all the tables that you created are here normally hope useful :)

Upvotes: 6

Sam Holder
Sam Holder

Reputation: 32936

I faced this issue and the only way I could get it to work was to create a new connection every time. Once i created a new connection it would show me the tables and I could use it, otherwise it would just leave the list empty

Upvotes: 1

Related Questions