richard-grin commented on issue #3813:
URL: https://github.com/apache/netbeans/issues/3813#issuecomment-1868861491

   Hello Matthias,
   
   First remark : This wizard worked well a long time ago (NetBeans 8.2; I 
don't remember exactly when it stopped working). At that time, we had just to 
give a datasource; a "connection" was not necessary. The window "New connection 
wizard" did not appear. I don't know why someone changed this behaviour.
   
   1. Create a database "customer" (the name for this example) in MySQL.
   
   2. With NetBeans 20, create a new Maven Web project for Jakarta EE10 (Java 
with Maven > Web Application) :
   
   3. You need to create a datasource in Payara (or another application server) 
named, for example "customer". With Payara, the simplest is to run these 2 
commands in asadmin of Payara (replace with your name and password in MySQL; 
asadmin is a file in the bin directory of the installation directory of Payara; 
run it) :
   
   > create-jdbc-connection-pool --datasourceclassname 
com.mysql.cj.jdbc.MysqlDataSource --restype javax.sql.DataSource --property 
portNumber=3306:user=****:password=****:databaseName=customer:serverName=localhost:useSSL=false:allowPublicKeyRetrieval=true:driverClass=com.mysql.cj.jdbc.Driver
 MySQLPool
   > create-jdbc-resource --connectionpoolid MySQLPool jdbc/customer
   
   The creation of a datasource is not standardized in the application servers. 
I think that the 2 commands above work with GlassFish too.
   
   4. Launch the wizard.
   
     - Choose the datasource created in step 3 (jdbc/cutomer).
   
     - A window "New Connection Wizard" appears. [**The problem is that you 
can't use an already defined connection.** ]
   
     - In this window, replace the name of the database with your name 
(customer for my example). The same for "User Name" and "Password". Tick 
"Remember password". Click on "Test Connection"; the message "Connection 
Succeded" is displayed. Click Next. Click Finish. The tables appear and you can 
choose the tables used to generate the entities.
   
   The problem is that, if latter you want to generate other entities from the 
same database, you will not be able to use the same connection. When the window 
"New Connection Wizard" will appear, and you click "Finish", you will receive 
the message "Unable to add connection. Connection already exists". A 
workaround: modify the value of "JDBC URL" in the window "New Connection 
Wizard", for example by adding a new property at the end. I have tried so many 
JDBC URL during my tests of the wizard that I can't use this workaround any 
longer...
   
   It would be good if, like in the ancient times, a datasource were enough, 
without using a connection. But perhaps the person that added the connection 
had a good reason. 
   
   Else, just after a datasource is choosen, the user should be able to choose 
among the already created connections. If I remember well, this is how it 
worked in NetBeans 12.1. *Now the problem is that a new connection is always 
necessary.*
   
   I hope my explanations will help you solve the problems with this wizard.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to