Netbeans Entity classes from database wizard fails - netbeans

My setup:
Netbeans 16 on windows 11
Mysql server 8
mysql-connector-java-8.0.30.jar
OpenJDK 64-Bit Server VM Microsoft-40354 (build 17.0.4.1+1-LTS, mixed mode, sharing)
Payara server 5.2 configured in Netbeans.
I have a legacy web application which uses Jdbc resources and connection pools defined in domain.xml inside Payara.
When I deploy the application it works correctly and can access the data in Mysql.
I need to add some new entities and I launch Entity classes from database wizard but it fails.
I had weird problems with that wizard in the past months but since then I changed computer reinstalling everything from scratch and the wizard doesn't work any more.
At step 2 I select a datasource which comes from Payara's domain.xml and an error is immediately reported:
Unable to find driver com.mysql.cj.jdbc.MysqlDataSource. Register this driver in databases tab
I think it refers to Tab Services, Databases tree node, drivers. Unfortunately I cannot add class MysqlDataSource there because it only accepts driver classes.
What can I do ?

I found two possible workarounds.
Temporarily remove the Payara server from Netbeans.
Now the Datasource select box is not populated from domain.xml
so you can finally choose a database connection already defined inside Netbeans or create a new one with "New datasource..."
Open domain.xml, search for the Jdbc connection pool you are going to use and add valid URL and driverClass properties

Related

Whille deploying RESTful webservice, Shows error JdbcDataSource. not found

I have been trying to create my first RESTful execrcise using. But I am unable to deploy module due to error "com.sun.appserv.connectors.internal.api.ConnectorRuntimeException: Invalid resource : jdbc/playerDB__pm"
I checked and I have JNDI, daata source created.
Unlike specified in link. I am using:
-Netbeans 8.0.3, Java EE 7, GlassFish Server 4.
Also I have checked GlassFish is running fine.
Edit 1:
I have re-checked my 'Services' tab, and I could not find jdbc/__playedDB ,even though I have created it.
Its a bug, the JDBC resource file is not being created (atleast with versions I am using: GlassFish 4.1, Netbeans 8.0.2). Using GlassFish manually create.
There could still be different error untill you set following connectins:
database(data source) <- connection pool <- JNDI.

Connect to DB2 using Rational Software Architect (RSA) 9.0

I want to know the steps for connecting to DB2 using RSA 9.0. I tried the below steps but I am not able to see any schema after connecting.
Opened Database development perspective
Right clicked on Database Connections and clicked on Add Repository
I have only 2 connection profile types listed -Derby and Generic JDBC (I am not sure whether this is the problem as I dont see DB2)
I selected Generic JDBC and clicked on Next
I clicked on new driver configuration add db2 jar (I have tried with db2jcc.jar as well as db2jcc4.jar) and provided the properties
For driver class, I clicked on Available classes from Jar list and used browse for class option. Here I selected com.ibm.db2.jcc.DB2Driver
I have given the connection url in the below format
jdbc:db2://DBServer:port/DBName
When I test the connection it shows ping succeeded. But when I try to open the schemas its blank
When I checked with my colleagues, they get DB2 connection profile in RSA. Let me know is there any option for me to add it.
I got the solution for this. In IBM installation manager, click on modify and select the language. Then in the list of available components select Data tools. Once installed, DB2 connection profile with IBM data server Driver will be available. Hope this helps.

IBM Worklight 6.1 - Project fails to initialize because the project database schema is from version N/A

I got the following error message when I try to deploy my .war file to the application server:
Error 500: javax.servlet.ServletException: Worklight Console
initialization failed.Logged Exception: java.lang.RuntimeException:
FWLSE0206E: The project /rmbp failed to initialize, because the
project database schema for data source
jdbc:db2://192.168.1.80:50001/APPCNTR is from version N/A, which is
not supported by the server from version 6.1.0.00.20131126-0630. Use
the Worklight ant tasks to upgrade the project database schema.
[project rmbp]
I already doing some research and ask IBM's about our issue as wellas reviewed the following similar question: IBM Worklight 6.1 - Unable to initialize the project due to DB2 error
It looks like you try to install a Worklight runtime to the APPCNTR database. This database is used for Application Center and is not related to the Worklight runtime database that is called WRKLGHT.
How do you install your Worklight war file : with the server configuration tool, the deployment ant scripts (that can be found in the configuration-samples directory of the Worklight installation) or manually ?
See http://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/index.jsp?topic=/com.ibm.worklight.deploy.doc/devref/r_ant_tasks_configure_dbs.html that explains how to configure the Worklight runtime database and deploy a Worklight runtime war file.
Have you create a jdbc connection in your Websphere Application Server?
It will be needed by the application inside the WAR file to connect to the database.
If you have done it, you can check inside your WAR file and look for web.xml file in WEB-INF/ folder. In my case I found a jdbc hardcoded inside the file, for example:
<resource-ref>
<description>Worklight Server Database</description>
<res-ref-name>jdbc/WorklightDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<resource-ref>
<description>Reports Database</description>
<res-ref-name>jdbc/WorklightReportsDS</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
You can rename those hardcoded file into the same name of the jdbc that you created in you WAS.
For the database issue, you can follow this link to use ant for DB creation.
http://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/index.jsp?topic=/com.ibm.worklight.deploy.doc/devref/r_ant_tasks_configure_dbs.html
If you follow the 1st ant script for DB2 creation which will have two different databases, you need to create the new user for this line if you haven't done so.
Because as you can see, in the xml script, user and password will be needed to create the WRKLGHT database. For example:
<db2 database="WRKLGHT" server="proddb.example.com"
user="wl6admin" password="wl6pass">
If you use non-default port for your DB2 connection, you can add on your port number parameter after the server parameter.
For example:
port="50001"
For user creation, u can follow this link:
http://publib.boulder.ibm.com/infocenter/db2luw/v9r5/index.jsp?topic=%2Fcom.ibm.db2.luw.qb.server.doc%2Fdoc%2Ft0006742.html
The error message looks pretty clear to me. You seem to have upgraded your Worklight installation, but did not upgrade the database scheme used for Application Center.
You need to consult with the IBM Worklight Information Center.
Upgrading to Worklight Server V6.1.0 in a production environment
You do not mention how did you upgrade your installation to v6.1.0, nor what did you do. So take a look at the following topic as well regarding database upgrade, since as mentioned it looks like your DB2 database scheme for the APPCNTR database did not take place:
Manually upgrading the Worklight Server V6.1.0 databases

Generating database and connection from schema

I'm using Glassfish server 4.0 as my app server for a java project in NetBeans 7.3.1. I have a database schema which I would like to include in my server as a database. Is there a way to generate the database in Glassfish based on a previous schema?
The extensions of the files are .frm and there's one .opt file.
Also, does Glassfish include a visual interface to modify a database's table's properties and registries?
Thanks in advance.
The answer to your the last part of your question is no. Glassfish itself does not include a visual interface for modifying database tables, properties etc. It includes a visual interface for creating JDBC Connection Pools and JDBC Resources. I personally use one integrated into my IDE of choice, Netbeans may have this feature, I happen to use IDEA. In production you could use any 3rd party app that does this, TOAD being a popular one but there are many.
I have some thoughts on the first part of your question but nothing ready to put into an answer at this point. When I do I'll update this one if its still an open question.

glassfish 4.0 jpa resource

I try to deploy my application but I still get deployment errors. I created connection pool succesfully (I can even create entities from tables using JPA Tools in Eclipse).
As you can see I've also created a JDBC Resource in Glassfish admin panel called sellyourthingres. When I use "sellyourthingres" instead of "sellyourthing" in persitance.xml nothing changes and i got exactly the same errors (with different name of course). Choosing JTA/JTA(default) doesn't change anything.
What should I do?