﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-GuoGuo之技术Blog-文章分类-代码管理</title><link>http://www.blogjava.net/tianjiaguo/category/32353.html</link><description>先理论后实践，理论指导实践！</description><language>zh-cn</language><lastBuildDate>Tue, 24 Jun 2008 21:14:53 GMT</lastBuildDate><pubDate>Tue, 24 Jun 2008 21:14:53 GMT</pubDate><ttl>60</ttl><item><title>JIRA Standalone 配置 MySql</title><link>http://www.blogjava.net/tianjiaguo/articles/210365.html</link><dc:creator>TianJiaGuo</dc:creator><author>TianJiaGuo</author><pubDate>Tue, 24 Jun 2008 10:28:00 GMT</pubDate><guid>http://www.blogjava.net/tianjiaguo/articles/210365.html</guid><wfw:comment>http://www.blogjava.net/tianjiaguo/comments/210365.html</wfw:comment><comments>http://www.blogjava.net/tianjiaguo/articles/210365.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/tianjiaguo/comments/commentRss/210365.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/tianjiaguo/services/trackbacks/210365.html</trackback:ping><description><![CDATA[<p>官方文档地址：<a style="color: #ff0000" href="http://www.atlassian.com/software/jira/docs/AllDocumentation.jspa">http://www.atlassian.com/software/jira/docs/AllDocumentation.jspa</a><br />
1、创建数据库：<br />
create database jira character set utf8;<br />
2、修改：conf/server.xml<br />
</p>
<p>&lt;Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; username="<span style="color: red">root</span>"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; password="<span style="color: red">guoguo</span>"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; driverClassName="<span style="color: red">com.mysql.jdbc.Driver</span>"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url="<span style="color: red">jdbc:mysql://localhost:3306/jira?autoReconnect=true&amp;amp;useUnicode=true&amp;amp;characterEncoding=UTF8</span>"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; minEvictableIdleTimeMillis="4000"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; timeBetweenEvictionRunsMillis="5000"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxActive="20" /&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Manager pathname=""/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Context&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Host&gt;<br />
3、修改：atlassian-jira/WEB-INF/classes/entityengine.xml<br />
&lt;datasource name="defaultDS" field-type-name="<span style="color: red">mysql</span>"<br />
&nbsp;&nbsp;helper-class="org.ofbiz.core.entity.GenericHelperDAO"<br />
&nbsp;&nbsp;check-on-start="true" use-foreign-keys="false"<br />
&nbsp;&nbsp;use-foreign-key-indices="false" check-fks-on-start="false"<br />
&nbsp;&nbsp;check-fk-indices-on-start="false" add-missing-on-start="true"<br />
&nbsp;&nbsp;check-indices-on-start="true"&gt;<br />
&nbsp;&nbsp;&lt;jndi-jdbc jndi-server-name="default"<br />
&nbsp;&nbsp;&nbsp;jndi-name="java:comp/env/jdbc/JiraDS" /&gt;<br />
&nbsp;&nbsp;&lt;!-- Orion format: &lt;jndi-jdbc jndi-server-name="default" jndi-name="jdbc/JiraDS"/&gt; --&gt;<br />
&nbsp;&nbsp;&lt;!-- JBoss format: &lt;jndi-jdbc jndi-server-name="default" jndi-name="java:/DefaultDS"/&gt; --&gt;<br />
&nbsp;&nbsp;&lt;!-- Weblogic format: &lt;jndi-jdbc jndi-server-name="default" jndi-name="JiraDS"/&gt; --&gt;<br />
&nbsp;&lt;/datasource&gt;<br />
&lt;/entity-config&gt;</p>
<span style="color: red">注意：在3时，datasource中的东西要删去，注释会报错！<br />
<br />
另：附官方说明：<br />
<p>1. Configure MySQL<br />
Create a database user which JIRA will connect as (e.g. jirauser).<br />
Create a database for JIRA to store issues in (e.g. jiradb). </p>
<p>The database must have a character set of UTF8. Enter the following command from within the MySQL command client: <br />
create database jiradb character set utf8;</p>
<p>(if you want your database to be named jiradb). <br />
Ensure that the user has permission to connect to the database, and create and populate tables.<br />
2. Copy the MySQL driver to your application server<br />
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. <br />
Note<br />
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).<br />
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).<br />
3. Configure your application server to connect to MySQL</p>
<p>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.)<br />
Warning<br />
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.</p>
<p>Note: if entered into an XML file, escape the '&amp;' with '&amp;amp;' as follows:<br />
&lt;Server port="8005" shutdown="SHUTDOWN"&gt;</p>
<p>&nbsp; &lt;Service name="Catalina"&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;Connector port="8080"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxHttpHeaderSize="8192" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; enableLookups="false" redirectPort="8443" acceptCount="100" <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; connectionTimeout="20000" disableUploadTimeout="true" /&gt;</p>
<p>&nbsp;&nbsp;&nbsp; &lt;Engine name="Catalina" defaultHost="localhost"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Context path="" docBase="${catalina.home}/atlassian-jira" reloadable="false"&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Resource name="jdbc/JiraDS" auth="Container" type="javax.sql.DataSource"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; username="[enter db username]"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; password="[enter db password]"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; driverClassName="com.mysql.jdbc.Driver"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url="jdbc:mysql://localhost/jiradb?autoReconnect=true&amp;amp;useUnicode=true&amp;amp;characterEncoding=UTF8"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ delete the minEvictableIdleTimeMillis and timeBetweenEvictionRunsMillis params here ]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Resource name="UserTransaction" auth="Container" type="javax.transaction.UserTransaction"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; factory="org.objectweb.jotm.UserTransactionFactory" jotm.timeout="60"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false"/&gt;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Context&gt;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/Host&gt;<br />
&nbsp;&nbsp;&nbsp; &lt;/Engine&gt;<br />
&nbsp; &lt;/Service&gt;<br />
&lt;/Server&gt;</p>
<p>(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/.)</p>
<p>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.<br />
Note<br />
MySQL closes idle connection after 8 hours, so the autoReconnect=true is necessary to tell the driver to reconnect<br />
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). <br />
4. Configure the JIRA Entity Engine</p>
<p>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:<br />
&lt;!-- DATASOURCE - You will need to update this tag for your installation.</p>
<p>--&gt;<br />
&nbsp; &lt;datasource name="defaultDS" field-type-name="mysql"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [ delete this, if it exists: schema-name="PUBLIC" ]<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; helper-class="org.ofbiz.core.entity.GenericHelperDAO"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; check-on-start="true"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; use-foreign-keys="false"<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ...<br />
&nbsp;&nbsp;&nbsp; <br />
Note<br />
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).<br />
Next steps</p>
<p>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.</p>
</span>
  <img src ="http://www.blogjava.net/tianjiaguo/aggbug/210365.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/tianjiaguo/" target="_blank">TianJiaGuo</a> 2008-06-24 18:28 <a href="http://www.blogjava.net/tianjiaguo/articles/210365.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>