Dashboard > iBATIS DataMapper > Home > Frequently Asked Questions > What should my properties.config file look like
What should my properties.config file look like
Added by Roberto Rabe, last edited by Ted Husted on Sep 15, 2005  (view change)
Labels: 
(None)


Your properties file should contain key and value settings that iBATIS can use when parsing your sqlMap.config file, SqlMap.xml files, or dao.config file. Here's an example:

<?xml version="1.0" encoding="utf-8" ?>
    <settings>
    <!--   User application and configured property settings go here.-->
    <!--   Example: <add key="settingName" value="settingValue"/> -->
    <add key="userid" value="myuser" />
    <add key="password" value="mypassword" />
    <add key="selectKey" value="select LAST_INSERT_ID() as value" />
    </settings>

You can use these keys in your SqlMap.config file:

<database>
    <provider name="ByteFx"/>
    <dataSource name="MyStore"
    connectionString="Data Source=MyStoreServer;Database=MyStoreDb;User Id=${userid};Password=${password}"/>
    </database>

Or in your SqlMaps:

<insert id="InsertAccount" parameterClass="Account">
    <selectKey property="Id" type="post" resultClass="int">
    ${selectKey}
    </selectKey>
    insert into Accounts
    (Account_Name, Account_Email)
    values
    (#Name#, #Email#);
    </insert>

Site running on a free Atlassian Confluence Open Source Project License granted to OSS. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.5 Build:#811 Jul 25, 2007) - Bug/feature request - Contact Administrators