GuoGuo之技术Blog

先理论后实践,理论指导实践!

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  0 随笔 :: 2 文章 :: 0 评论 :: 0 Trackbacks

官方文档地址:http://www.atlassian.com/software/jira/docs/AllDocumentation.jspa
1、创建数据库:
create database jira character set utf8;
2、修改:conf/server.xml

<Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false">
          <Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"
            username="root"
            password="guoguo"
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost:3306/jira?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF8"
            minEvictableIdleTimeMillis="4000"
            timeBetweenEvictionRunsMillis="5000"
            maxActive="20" />          <Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"
            factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
          <Manager pathname=""/>
        </Context>

      </Host>
3、修改:atlassian-jira/WEB-INF/classes/entityengine.xml
<datasource name="defaultDS" field-type-name="mysql"
  helper-class="org.ofbiz.core.entity.GenericHelperDAO"
  check-on-start="true" use-foreign-keys="false"
  use-foreign-key-indices="false" check-fks-on-start="false"
  check-fk-indices-on-start="false" add-missing-on-start="true"
  check-indices-on-start="true">
  <jndi-jdbc jndi-server-name="default"
   jndi-name="java:comp/env/jdbc/JiraDS" />
  <!-- Orion format: <jndi-jdbc jndi-server-name="default" jndi-name="jdbc/JiraDS"/> -->
  <!-- JBoss format: <jndi-jdbc jndi-server-name="default" jndi-name="java:/DefaultDS"/> -->
  <!-- Weblogic format: <jndi-jdbc jndi-server-name="default" jndi-name="JiraDS"/> -->
 </datasource>
</entity-config>

注意:在3时,datasource中的东西要删去,注释会报错!

另:附官方说明:

1. Configure MySQL
Create a database user which JIRA will connect as (e.g. jirauser).
Create a database for JIRA to store issues in (e.g. jiradb).

The database must have a character set of UTF8. Enter the following command from within the MySQL command client:
create database jiradb character set utf8;

(if you want your database to be named jiradb).
Ensure that the user has permission to connect to the database, and create and populate tables.
2. Copy the MySQL driver to your application server
Download the MySQL Connector/J JDBC driver, eg. version 3.1.12 (tar.gz or zip) which we have verified to work. NOTE: the older 3.1.11 driver is broken.
Note
A user has reported encountering problems using the Resin JDBC driver for MySQL. However, the Connector/J driver from MySQL works correctly (except for version 3.1.11).
Add the MySQL JDBC driver jar (mysql-connector-java-3.x.x-bin.jar) to the common/lib/ directory. NOTE: Do not place the Debug Driver (mysql-connector-java-3.x.x-bin-g.jar) on the CLASSPATH as this can cause issues (JRA-8674).
3. Configure your application server to connect to MySQL

Edit conf/server.xml (if you are using JIRA Standalone) and customise the username, password, driverClassName and url parameters for the Datasource. (If you are using JIRA WAR/EAR, edit the appropriate file on your application server; e.g. for Tomcat, edit conf/Catalina/localhost/jira.xml.)
Warning
The URL in the XML below assumes a UTF-8 database - i.e. created with create database jiradb character set utf8;. If you don't specify character set utf8 you risk getting 'Data truncation: Data too long for column' errors when importing data or corruption of non-supported characters. See storing non-ASCII characters in MySQL for details.

Note: if entered into an XML file, escape the '&' with '&amp;' as follows:
<Server port="8005" shutdown="SHUTDOWN">

  <Service name="Catalina">

    <Connector port="8080"
      maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
      enableLookups="false" redirectPort="8443" acceptCount="100"
      connectionTimeout="20000" disableUploadTimeout="true" />

    <Engine name="Catalina" defaultHost="localhost">
      <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">

        <Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false">
          <Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"
            username="[enter db username]"
            password="[enter db password]"
            driverClassName="com.mysql.jdbc.Driver"
            url="jdbc:mysql://localhost/jiradb?autoReconnect=true&amp;useUnicode=true&amp;characterEncoding=UTF8"
            [ delete the minEvictableIdleTimeMillis and timeBetweenEvictionRunsMillis params here ]
            />

          <Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"
            factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/>
          <Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false"/>
        </Context>

      </Host>
    </Engine>
  </Service>
</Server>

(Note: if you can't find this section at all, you've probably got the wrong file - search for mentions of 'jira' in the files under conf/.)

The URL above assumes a UTF-8 database - ie. created with create database jiradb character set utf8;. If you don't specify character set utf8 you risk getting 'Data truncation: Data too long for column' errors when importing data. See storing non-ASCII characters in MySQL for details.
Note
MySQL closes idle connection after 8 hours, so the autoReconnect=true is necessary to tell the driver to reconnect
If you are using JIRA Standalone, edit conf/server.xml, and delete the minEvictableIdleTimeMillis and timeBetweenEvictionRunsMillis attributes (which are only needed for HSQL, and degrade performance otherwise).
4. Configure the JIRA Entity Engine

Edit atlassian-jira/WEB-INF/classes/entityengine.xml (if you are using JIRA Standalone) or edit-webapp/WEB-INF/classes/entityengine.xml (JIRA WAR/EAR), and change the field-type-name attribute to mysql. (If you forget to do this and start JIRA, it may create database tables incorrectly. See this page if this happens to you.) Also delete the schema-name="PUBLIC" attribute, if it exists:
<!-- DATASOURCE - You will need to update this tag for your installation.

-->
  <datasource name="defaultDS" field-type-name="mysql"
      [ delete this, if it exists: schema-name="PUBLIC" ]
      helper-class="org.ofbiz.core.entity.GenericHelperDAO"
      check-on-start="true"
      use-foreign-keys="false"
      ...
   
Note
If you are using JIRA WAR/EAR, your application server may require other changes to entityengine.xml (e.g. to customize the jndi-jdbc tag).
Next steps

You should now have an application server configured to connect to a database, and JIRA configured to use the correct database type. If you are using JIRA Standalone, start it up and watch the logs for any errors. If you are using the JIRA WAR/EAR distribution, rebuild and redeploy the webapp in your application server.

posted on 2008-06-24 18:28 TianJiaGuo 阅读(425) 评论(0)  编辑  收藏 所属分类: 代码管理

只有注册用户登录后才能发表评论。


网站导航: