JamesBranam's Blog
Data Sources
Hi,
Today We'll take a quick look at data source references, or more precisely, how we choose which data sources will be used in a web application. First of all, let's explain what a data source is. There is a lot of confusion between the terms data source and database connection. A data source provides applications with a means of connecting to a database. It refers to s specific type of database connection. We can assign names to them to tell them apart. Let's see how it's done in NetBeans 6.0:
Let's assume that we've already created a web application using Visual Web JavaServer Faces.
- In the Outline window, double-click the SessionBean1 node.
SessionBean1.java opens in the Editor. - Right-click anywhere in the Editor and choose Enterprise Resources > Use Database.
The Choose Database dialog box opens.
- You can enter the Reference Name yourself, or you can let the IDE help you. To add a data source reference, click Add.
The Add Data Source Reference dialog box opens. The IDE lists data sources already associated with the project.
I've entered MyDatsSource as the Reference Name. Click OK.
The Choose Database dialog box reappears. - Note how the Data Source Reference appears (data source name then database connection information). Click OK to finish.
At a later date we'll take a look at other ways of doing this. We'll also take a closer look at the Choose Database dialog box.
See you soon,
--James
Posted at 01:53PM May 31, 2007 by branajam in Sun |