Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

These instructions will help you connect TermWeb to a Microsoft SQL Server 2012 database.

1. Create and Configure the SQL Server Database

  1. Create a database for TermWeb to store data in (e.g. termweb). 
    • Open pgAdmin and right click on Databases and select New Database
      Encoding: UTF8
      Template: template0
      Collation: C
      Character Type: C

  2. Create a database login role (user) which TermWeb will connect as (e.g. termwebuser), with permissions for the database.
    • Create a new login role (right click on Login Roles and select New Login Role) and name it termwebuserSelect password: termwebuser.
    • Set login role as database owner and set permissions (right click on termweb database and select Properties). Select termwebuser as owner.

  3. Execute the termweb_postgresql.sql file from the installation package to create the database tables.
    • Select termweb database and click on SQL icon to open an SQL execution window.
    • In SQL Server Management Studio, navigate to File > Open > File and select the file.
    • Right-click and select Execute, or just press F5 to run the script.

2. Copy the SQL Server JDBC Driver to Tomcat

  1. Download the SQL Server JDBC driver (v1.3.1) from jTDS.
  2. Add the SQL Server JDBC driver jar (jtds-1.3.1.jar) to <tomcat-install>/lib/ directory.

3. Configure a DataSource for TermWeb in Tomcat

  1. Edit <tomcat-install>/conf/context.xml

     

  2. Within the Context tags, insert the DataSource Resource tag:

    <Resource name="jdbc/TermWebDS"
    auth="Container"
    type="javax.sql.DataSource"
    driverClassName="net.sourceforge.jtds.jdbc.Driver"
    url="jdbc:jtds:sqlserver://localhost/termwebdb;user=termwebuser;password=termwebpwd;useLOBs=false"
    maxActive="20"
    maxIdle="10"
    validationQuery="Select 1"/>

      • If SQL Server 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 termwebdb, replace termwebdb in url with your database name 
      • Replace termwebuser and termwebpwd in url with your database user and password.

    The configuration properties for Tomcat's standard data source resource factory (org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory) are as follows:

      • driverClassName – Fully qualified Java class name of the JDBC driver to be used.
      • maxActive – The maximum number of active instances that can be allocated from this pool at the same time.
      • maxIdle – The maximum number of connections that can sit idle in this pool at the same time.
      • maxWait – The maximum number of milliseconds that the pool will wait (when there are no available connections) for a connection to be returned before throwing an exception.
      • password – Database password to be passed to our JDBC driver.
      • url – Connection URL to be passed to our JDBC driver. (For backwards compatibility, the property driverName is also recognized.)
      • user – Database username to be passed to our JDBC driver.
      • validationQuery – SQL query that can be used by the pool to validate connections before they are returned to the application. If specified, this query must be an SQL SELECT statement that returns at least one row.

     

(tick) Congratulations, you now have TermWeb connected to your SQL Server database.

  • No labels