You can access a database from a web service by using a Database control. You can either use and existing Database control or create a new one.
To Add an Existing Database Control to Your Web Service
To Create a New Database Control for Your Web Service
Note: The cgSampleDataSource data source is available for experimentation. For more information about data sources, see Creating a New Database Control.
Once you have added the Database control to your web service, you may invoke methods on the control as you would with any other Java object.
Adding a Method to a Database Control
How Do I: Connect a Database Control to a Database Such as SQL Server or Oracle?