I've installed tomcat7 and mysql55 on my ami linux micro instance. I'm trying to figure out how to configure tomcat7 to communicate with mysql, but have had no luck. I've always been a glassfish user, so it was pretty simple to do through the gui, however with tomcat, I'm not sure how to configure this.
I've looked at the apache documentation on tomcat7, but found myself even more confused. I do not know where the files are I need to edit and I do not know what to edit them with. Do I need to install a mysql driver? Do I use JDBC or JNDI? My app is a Tapestry5 app that uses Hibernate, so I'm not sure if that matters.
Does anybody know of a nice guide or could provide me with example code on how to do this? Just for the record, I only have a couple hours behind the wheel of linux, so I'm very green when it comes to anything linux related.
I found the following default configuration
<!-- <Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> -->
I'm using hibernate and in the hibernate.cfg.xml I'm using the following
<hibernate-configuration> <session-factory> <property name="hibernate.connection.datasource">jdbc/mydatabase</property>
I commented out the above resource and added the following, but this also doesn't seem to work. I also noticed I no longer have access to the tomcat manager either.
<Resource type="javax.sql.DataSource" name="jdbc/mydatabase" factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/mysql" username="root" password="password" />
I added the following to the context.xml file
<ResourceLink type="javax.sql.DataSource" name="jdbc/mydatabase" global="jdbc/mydatabase"
Does anybody know what I'm doing wrong with this configuration?