Basic Database Access


Setting Up Your Database

For all of the examples in this chapter, you communicate with a MySQL database that has a number of tables. To access the database, you use a Java Naming and Directory Interface (JNDI) entry defined as:

 <database>     <jndi-name>jdbc/mysql</jndi-name>     <driver type="org.gjt.mm.mysql.Driver">     <url>jdbc:mysql://localhost:3306/test</url>     <user></user>     <password></password>     </driver>     <max-connections>20</max-connections>     <max-idle-time>30s</max-idle-time>     <xa>true</xa>   </database> 

We used the <xa> element to indicate the driver supports the concept of transactions, which are part of our examples.




Mastering Resin
Mastering Resin
ISBN: 0471431036
EAN: 2147483647
Year: 2002
Pages: 180

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net