If you have tried the Netbeans Rest Webservice example, using Mysql, do not despair. There is a way to make it work. Here is what you need to do.
- Create JDBC Connection Pools and JDBC Resources, in this order, in your GlaassFish Server admin tool ( localhost:4848), as shown below. In this example, I called the Connection Pool as mysql_sample_rootPool and the Resource as jdbc/mysql-sample.
2. Now you will need to add some extra properties to the JDBC Connection Pool that you just created. Click on it, and click on the Additional Properties Button, as shown below.
3. You will add to the JDBC Connection Pool most of the properties indicated in the figure below. That is, you will add the properties user, password, Url, and driverClass. The Url you will obtain by following the initial steps described in the Netbeans tutorial.
4. Now you are ready to follow the steps in the tutorial. One difference will be when it comes to select the Data Source. In step 2, described above, you created a JDBC Resource. I called mine jdbc/mysql-sample. In this step, you will select the resource that you created (it is available in the dropdown choices).
5. Once you select the Data Source, the tables should be available. If they are not, most likely the connection that you created in the initial steps of the NetBeans tutorial is not available or it is broken (you can verify by looking at the NetBeans Services tab, as shown in the Figure below). Fix it, and come back to this step.
6. If everything is ok, this is what you will see:
7. You can easily test if everything is ok by going to the RESTful WebServices part of your project, right click on one of the services, for instance CustomerFacadeREST, and select "Test Resource Uri". If everything is ok, you will see
If this tutorial was helpful to you, please consider making a donation. A donation can be in several forms: post in your facebook, post in your blog, etc Thank you,
P.S. I am looking for a job opportunity. If you know any, please send my way. Thanks.