This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 255433 - Unable to create Database entities from mysql datasource
Summary: Unable to create Database entities from mysql datasource
Status: NEW
Alias: None
Product: db
Classification: Unclassified
Component: MySQL (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Libor Fischmeistr
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-20 17:25 UTC by pbuser
Modified: 2015-09-25 02:34 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pbuser 2015-09-20 17:25:21 UTC
I am using Netbeans ide 8.0.2. with GF version 4.0.1 to create Restful webservice.

I created Web Project, and started with "New Restful Webservices from Database" wizard and data sources combo lists all the existing data source, I selected "jdbc/mysqldatasource" which I created in GF admin console, despite it being an existing connection suddenly a "New Connection Wizard" pops up without host and database name value.Why it is not using the datasource value which I entered in GF admin console?. So I enter the DB and host and click next and in the choose database wizard I don't see the schema selected.Why? when I click next 
I see url - "jdbc:mysql://localhost:3306/mydb [root on Default schema]"
[root on Default schema] is the new parameter added to the url.
I deleted the new parameter and clicked finish.



I'm back in "New Restful Webservices from database" wizard and available tables list is empty. There is a warning which says "Select the table source" .I have no idea why it behaves like this? If I go through the process of add connection again I get "connection already exists" error.
Comment 1 matthias42 2015-09-23 20:52:12 UTC
This is not yet a solution, but it might help you:

Netbeans does not use the DataSources of the application server to access the databases, but maps the connections to local Database connections. I recently fixed two bugs in that area, but in the end this is what you need to know.

You need to modify the JDBC connection pool properties (Glassfish Webinterface: Resources -> JDBC -> JDBC Connection Pools -> <targetpool> -> Additional Properties.

There you need to add these properties:

User
DriverClass
URL
Password [Optional]

User and Password are self describing. URL must bean an JDBC Url, that points to the same database as the datasource and DriverClass must be the JDBC driver class that can be used to connect to the database.

To be a bit clearer - lets asume I have a Derby connection Pool. That pool is established by the datasource implemenation org.apache.derby.jdbc.ClientDataSource (this is the glassfish sample pool):

The properties that are defined are:

PortNumber => 1527
Passwort => APP
User => APP
serverName => localhost
DatabaseName => sun-appserv-samples
connectionAttributes => ;create=true


To make this compatible with the current netbeans "way" this needs to be added:

DriverClass => org.apache.derby.jdbc.ClientDriver
URL => jdbc:derby://localhost:1527/sun-appserv-samples;create=true

There is right now a bug in the nightlies, that cause the username and password not to be pulled from the properties - I'm at it, but have to dig a bit, so please make sure, that when you create the db connection to enter the correct username.
Comment 2 pbuser 2015-09-25 02:34:26 UTC
Thank you Mathias.

After updating the URL in GF admin with host and db name I'm able to successfully use the data source to create entities.