How to config Atlassian-SDK's Jira to use custom JDBC database instead of H2

Hello @hy.duc.nguyen,

The way I did it is to use maven-amps-plugin in my POM and declaring the datasource there. In a nutshell, I did it like this (for mySql but should be similar with Postgre)

<plugin>
	<groupId>com.atlassian.maven.plugins</groupId>
	<artifactId>maven-amps-plugin</artifactId>
	<version>${amps.version}</version>
	<extensions>true</extensions>
	<configuration>
		<productVersion>${jira.version}</productVersion>
		<productDataVersion>${jira.version}</productDataVersion>
		<instanceId>myJira</instanceId>
		<products>
			<product>
				<id>jira</id>
				<instanceId>myJira</instanceId>
				<version>${jira.version}</version>
				...
				<dataSources>
					<dataSource>
						<jndi>jdbc/JiraDS</jndi>
						<url>jdbc:mysql://localhost:3306/jira8</url>
						<driver>com.mysql.jdbc.Driver</driver>
						<username>root</username>
						<password>root</password>
						<libArtifacts>
							<libArtifact>
								<groupId>mysql</groupId>
								<artifactId>mysql-connector-java</artifactId>
								<version>5.1.22</version>
							</libArtifact>
						</libArtifacts>
					</dataSource>
				</dataSources>
			</product>
		</products>
	</configuration>
</plugin>

If you want to test your server app using a different DB, you can read more in this Declaring JNDI datasources in AMPS documentation.

Hope this helps.
Ian

1 Like