<sqlMap resource="SqlMap.xml" />
C Provides name of
D Provides your SQL Maps
As you may have guessed, this is where we tell i BATIS how to connect to the data-
base and which SQL Map files are available. Since it is an XML document, we need
to provide a doctype and DTD for validation . SIMPLE is the name of a built-in
transaction manager . Here is where you provide the name of your JDBC driver,
the JDBC URL , a username, and a password that lets you connect to the database.
Then you provide your SQL Maps . Here, we only have one SQL Map, but you
can have as many as you want. There are a few other things you can do here, but
we cover them all in the next chapter.
Now that you have seen the main configuration file, let's take a look at the
SqlMap.xml file (listing 2.6). This is the file that contains the SQL statement that
we will be running.
The simplest SQL Map ever
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
<select id="getAllUsers" parameterClass="string"
SELECT * FROM USER_ACCOUNT WHERE GROUPNAME = #groupName#
In the XML code in listing 2.6, we're accepting a String parameter ( parameter-
Class ) for the GROUPNAME parameter, and mapping the results ( resultClass ) to a