Warning | ||
---|---|---|
| ||
Rewrite like SQL Server connection page |
1. Shut down Tomcat
- Run
bin/shutdown.sh
orbin/shutdown.bat
to bring Tomcat down while you are making these changes. - Make a backup of your
server.xml
andcontext.xml
files in<tomcat-install>/conf/
so that you can easily revert if you have a problem.
2. Install the Drivers
- Download the MySQL Connector/J JDBC driver from http://dev.mysql.com/downloads/connector/j/
- After unpacking the file you have downloaded, you will find a file called something like
mysql-connector-java-5.1.22-bin.jar
. - If you are running Tomcat 6.x or Tomcat 7.x, copy the file into
<tomcat-install>/lib.
On Tomcat 5.5, copy this file into thecommon/lib
directory of your Tomcat installation.
...
These instructions will help you connect TermWeb to a MySQL database.
1. Configuring MySQL
MySQL should allow packet sizes at least the size of maximum file attachment size, by default 15000 KB.
The default max packet size is 1MB, and you can configure this in your MySQL configuration file by setting the property max_allowed_packet. See the MySQL manual for more information.
2. Create database
Create the TermWeb database by opening a DOS prompt and enter the following:
mysql -u root -p < createdb.sql
This creates an empty database called
termweb
and a usertermwebuser
with passwordtermwebpwd
. The user name and password can be changed as desired. The user currently needs all permissions (except GRANT) in the database.Import the
termweb.sql
file to the database, by running the following at the DOS prompt:mysql -u termwebuser -pptermwebpwd termwebpwd termweb < termweb.sql
The database is now set up.
4. Configure Tomcat
...
3. Copy the MySQL JDBC Driver to Tomcat
- Download the MySQL Connector/J JDBC driver from http://dev.mysql.com/downloads/connector/j/
- After unpacking the file you have downloaded, you will find a file called something like
mysql-connector-java-5.1.x-bin.jar
. Copy the file into
<tomcat-install>/lib.
Warning title Please note MySQL Connector/J v5.1.36 contains a bug which causes it not to work together with MySQL 5.0.x.
4. Configure a DataSource for TermWeb in Tomcat
Edit
<tomcat-install>/conf/servercontext.xml
.Within the the
Context
tags tags, insert the DataSourceResource
DataSourceResource
tag:<Resource name="jdbc/TermWebDS"
termwebpassword
auth="Container"
type="javax.sql.DataSource"
username="termwebuser"
password="termwebpwd"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/termweb?autoReconnect=true&
useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true"
maxActive
maxTotal="20"
maxIdle="10"
minIdle="2"
testWhileIdle="true"
validationQuery="Select 1"/>- Replace the username and password parameters with the correct values for your database. In the url parameter, replace the word 'termweb' with the name of the database your TermWeb data will be stored in.
- Check Version specific upgrade notes for any actions needed for your TermWeb version.
If MySQL does not run on the same server as Tomcat, replace localhost
in url with the name of the database server.
If you named the database something else than termweb
, replace termweb
in url with your database name.
Replace termwebuser
and termwebpwd
in url with your database user and password.
Warning | ||
---|---|---|
| ||
Changes in |
Include Page | ||||
---|---|---|---|---|
|
4. Restart Tomcat
Run bin/startup.sh
or bin/startup.bat
to start Tomcat and TermWeb with the new settings Congratulations, you now have TermWeb connected to your MySQL database.