Chris,
I would suggest using Tomcat connection pooling. I think that there is
documentation on the Tomcat site for setting it up. Doing so will give
you much better performance. You would access the connection pool via a
JNDI datasource in iBATIS. With the configuration that you have, it will
take about a second each time you access the database just to establish
the connection.
-Richard
Chris Marshall wrote:
This is not really an iBatis query, but I have little experience with
deploying applications via Tomcat, and would like to find a url which
will help. I have checked the JPetStore application and googled dozens
of sites without success:
The application works well in GWT hosted and browser mode, and the GWT
client works fine via Tomcat. The problem is I don't know how to
deploy the server side java code with iBatis and MySql and cannot find
a suitable knowledge base:
The Tomcat WEB-INF has web.xml and SqlMapConfig.xml files:
apache-tomcat-6.0.10/webapps/myapp/WEB-INF/web.xml
apache-tomcat-6.0.10/webapps/myapp/WEB-INF/SqlMapConfig.xml
where web.xml is:
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<display-name>MyApp Web</display-name>
<description>MyApp Web Application</description>
<servlet>
<servlet-name>MyAppService</servlet-name>
<servlet-class>net.cbtltd.server.MyAppServer</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MyAppService</servlet-name>
<url-pattern>/MyAppService</url-pattern>
</servlet-mapping>
<description>MyApp</description>
<resource-ref>
<res-ref-name>jdbc/MyAppDb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
and SQLMapConfig.xml is:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">
<sqlMapConfig>
<settings useStatementNamespaces="true" />
<transactionManager type="JDBC" commitRequired="true">
<dataSource type="JNDI">
<property name="JDBC.Driver" value="com.mysql.jdbc.Driver"/>
<property name="JDBC.ConnectionURL"
value="jdbc:mysql://localhost:3306/MyAppDb"/>
<property name="JDBC.Username" value=""/>
<property name="JDBC.Password" value=""/>
</dataSource>
</transactionManager>
<!-- List the SQL Map XML files. -->
<sqlMap resource="xml/account_SqlMap.xml"/>
.................
</sqlMapConfig>
The MyAppServer.jar is in the WEB-INF/lib subdirectory, and the
SqlMap.xml files are in the WEB-INF/xml subdirectory (not in a jar)
I am using the most recent versions of GWT, iBatis and MySql on
Windows2000 Professional.
Hope someone can point me in the right direction!
Thanks, Chris Marshall