Java Reference
In-Depth Information
If you're not using a real relational database, we recommend that you stick
with raw JDBC or even a lower-level file I/O API .
2.4.4
When it simply does not work
i BATIS has a lot of great features that continue to be implemented as the needs of
the community grow. However, i BATIS does have a direction as well as design goals
that will sometimes conflict with the needs of some applications. People do
amazing things with software, and there have been cases where i BATIS simply did
not work because of a complex requirement. Although we may have been able to
add features to support the requirement, it would have added significant
complexity or perhaps would have changed the scope of the i BATIS framework. As
a result, we would not change the framework. To support these cases, we try to
offer pluggable interfaces so that you can extend i BATIS to meet nearly any need.
The simple fact is, sometimes it just doesn't work. In these cases it's best to find a
better solution, rather than try to twist i BATIS (or any framework) into something
that it is not.
So instead of continuing to discuss the whys and why nots, let's look at a simple
example.
2.5 i BATIS in five minutes
The i BATIS framework is a very simple one, and getting started with it is equally
simple. How simple? Well, simple enough that we can build an entire application
that uses i BATIS in five minutes—not a big Enterprise Resource Planning ( ERP )
solution or massive e-commerce website, but a simple command-line tool to exe-
cute a SQL statement from an i BATIS SQL Map and output the results to the con-
sole. The following example will configure a simple static SQL statement to query
a simple database table and write it to the console like this:
java -classpath <…> Main
Selected 2 records.
{USERNAME=LMEADORS, PASSSWORD=PICKLE, USERID=1, GROUPNAME=EMPLOYEE}
{USERNAME=JDOE, PASSSWORD=TEST, USERID=2, GROUPNAME=EMPLOYEE}
Not exactly the prettiest data output, but you get the picture of what it is going to
do. In the next few sections, we will walk through the steps to get you from noth-
ing to this level of functionality.
Search WWH ::




Custom Search