|
|
Note that these steps are taken from my IDE, Netbeans 3.3. Since
Sun ONE/Forte' is based on the open-source NetBeans products, these steps
should be similar or the same.
-
Running a query requires a small handfull of classes to instantiate and
include. This confused me as a novice, I just wanted a simple class
to set my database properties and send my queries.
-
Let's try to make a bean to do this. We can set all of the database
properties in the property window for the bean.
-
This really limits our flexibility, because we are essentially hardcoding
the values in the class.
-
But it is another alternative we can use.
-
Also, given that beans are often used by novice programmers, we can make
an assumption that this will be a fairly small-scale application.
-
In the future, we can optimize this bean for database connection pooling,
instantiation from properties files where the files are the properties
we set, and perhaps even metadata.
-
NetBeans gets you started with an example. Simply choose New-Beans-Bean,
and you get this source.
-
To explain this source, we need to look at properties of beans.
Properties of Beans
|