Skip to content

Commit

Permalink
Added support for Microsoft SQL Server via jtds driver.
Browse files Browse the repository at this point in the history
  • Loading branch information
smsearcy committed Jan 7, 2015
1 parent 731d11f commit 4f97437
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
4 changes: 4 additions & 0 deletions jira.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,15 @@ jira::group: jira
jira::db: postgresql
#jira::db: mysql
#jira::db: oracle
#jira::db: sqlserver

jira::dbtype: postgres72
#jira::dbtype: mysql
#jira::dbtype: mssql

jira::dbdriver: org.postgresql.Driver
#jira::dbdriver: com.mysql.jdbc.Driver
#jira::dbdriver: net.sourceforge.jtds.jdbc.Driver

# Change these values to your jira database credentials
jira::dbuser: jiraadm
Expand All @@ -54,6 +57,7 @@ jira::dbname: jira
jira::dbport: 5432
#jira::dbport: 3306
#jira::dbport: 1521
#jira::dbport: 1433

# The connection pool size
jira::poolsize: 20
Expand Down
2 changes: 2 additions & 0 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
$validationQuery = $jira::db ? {
'postgresql' => 'select version();',
'mysql' => 'select 1',
'sqlserver' => 'select 1',
}
}
if $jira::timeBetweenEvictionRuns == undef {
$timeBetweenEvictionRuns = $jira::db ? {
'postgresql' => '30000',
'mysql' => '300000',
'sqlserver' => '300000',
}
}

Expand Down
5 changes: 3 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@

Exec { path => [ '/bin/', '/sbin/' , '/usr/bin/', '/usr/sbin/' ] }

if $jira::db != 'postgresql' and $jira::db != 'mysql' {
fail('jira db parameter must be postgresql or mysql')
if $jira::db != 'postgresql' and $jira::db != 'mysql' and $jira::db != 'sqlserver' {
fail('jira db parameter must be postgresql or mysql or sqlserver')
}

if $::jira_version {
Expand All @@ -126,6 +126,7 @@
$dburl_real = $db ? {
'postgresql' => "jdbc:${db}://${dbserver}:${dbport}/${dbname}",
'mysql' => "jdbc:${db}://${dbserver}:${dbport}/${dbname}?useUnicode=true&characterEncoding=UTF8&sessionVariables=storage_engine=InnoDB",
'sqlserver' => "jdbc:jtds:${db}://${dbserver}:${dbport}/${dbname}",
}
}

Expand Down
26 changes: 26 additions & 0 deletions templates/dbconfig.sqlserver.xml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>

<jira-database-config>
<name>defaultDS</name>
<delegator-name>default</delegator-name>
<database-type><%= scope.lookupvar('jira::dbtype') %></database-type>
<schema-name>dbo</schema-name>
<jdbc-datasource>
<url><%= scope.lookupvar('jira::dburl_real') %></url>
<driver-class><%= scope.lookupvar('jira::dbdriver') %></driver-class>
<username><%= scope.lookupvar('jira::dbuser') %></username>
<password><%= scope.lookupvar('jira::dbpassword') %></password>
<pool-size><%= scope.lookupvar('jira::poolsize') %></pool-size>
<pool-min-size><%= scope.lookupvar('jira::poolMinSize') %></pool-min-size>
<pool-max-size><%= scope.lookupvar('jira::poolMaxSize') %></pool-max-size>
<pool-max-wait><%= scope.lookupvar('jira::poolMaxWait') %></pool-max-wait>
<validation-query><% if @validationQuery %><%= @validationQuery %><% else %>scope.lookupvar('jira::validationQuery')<% end %></validation-query>
<min-evictable-idle-time-millis><%= scope.lookupvar('jira::minEvictableIdleTime') %></min-evictable-idle-time-millis>
<time-between-eviction-runs-millis><% if @timeBetweenEvictionRuns %><%= @timeBetweenEvictionRuns %><% else %><%= scope.lookupvar('jira::timeBetweenEvictionRuns') %><% end %></time-between-eviction-runs-millis>
<pool-max-idle><%= scope.lookupvar('jira::poolMaxIdle') %></pool-max-idle>
<pool-remove-abandoned><%= scope.lookupvar('jira::poolRemoveAbandoned') %></pool-remove-abandoned>
<pool-remove-abandoned-timeout><%= scope.lookupvar('jira::poolRemoveAbandonedTimout') %></pool-remove-abandoned-timeout>
<pool-test-while-idle><%= scope.lookupvar('jira::poolTestWhileIdle') %></pool-test-while-idle>
<pool-test-on-borrow><%= scope.lookupvar('jira::poolTestOnBorrow') %></pool-test-on-borrow>
</jdbc-datasource>
</jira-database-config>

0 comments on commit 4f97437

Please sign in to comment.