Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document changes for Azure SQL support in Apicurio #15

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions _pages/studio/docs/switching-to-mysql-or-postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ updatedAt: "2019-11-14T16:25:34.359Z"
---
By default, the Apicurio Studio quickstart is configured to use a simple (but persistent) H2 database. Unless you are simply evaluating the software, you will likely want to switch to using an external database such as MySQL or PostgreSQL.

## 1. Install MySQL or PostgreSQL
Obviously the first step is to download and install [MySQL](https://www.mysql.com/) or [PostgreSQL](https://www.postgresql.org/). Installation and configuration of the database you choose is outside the scope of this article.
## 1. Install MySQL or PostgreSQL or Configure AzureSQL
Obviously the first step is to download and install [MySQL](https://www.mysql.com/) or [PostgreSQL](https://www.postgresql.org/) or configure AzureSQL database. Installation and configuration of the database you choose is outside the scope of this article.

## 2. (optional) Install the Apicurio Studio DDL
Fire up your favorite SQL tool (for example if you're using MySQL then it's likely the MySQL Workbench) and use it to initialize your Apicurio Studio database with the appropriate DDL:
Expand All @@ -26,7 +26,7 @@ Fire up your favorite SQL tool (for example if you're using MySQL then it's like
## 3. Configure Apicurio Studio to use your Database
Once the database is created (and optionally initialized) you will need to tell Apicurio Studio how to connect. There are three main tasks you should be concerned with:

* Download & Deploy a Database Driver (MySQL or PostgreSQL driver)
* Download & Deploy a Database Driver (MySQL or PostgreSQL or AzureSQL driver)
* Database connection (a DataSource configured in standalone.xml)
* Database **type** (configured as a system property or environment variable)

Expand All @@ -37,6 +37,7 @@ In order for Apicurio Studio to connect to your database, you will need to insta

* Download [MySQL Driver](https://dev.mysql.com/downloads/connector/j/)
* Download [PostgreSQL Driver](https://jdbc.postgresql.org/download.html)
* Download [AzureSQL Driver](https://go.microsoft.com/fwlink/?linkid=2155948)

Once downloaded, extract the package (if necessary) and then copy the JDBC driver .jar file to the following location:

Expand Down Expand Up @@ -87,6 +88,19 @@ Replace the above with a DataSource configured for your specific database. Exam
</datasource>
```

#### AzureSQL
```xml
<datasource jndi-name="java:jboss/datasources/ApicurioDS"
pool-name="ApicurioDS" enabled="true" use-java-context="true">
<connection-url>jdbc:sqlserver://AZURESQLSERVER:1433;databaseName=DATABASENAME</connection-url>
<driver>mssql-jdbc-8.4.1.jre8.jar</driver>
<security>
<user-name>DBUSEU</user-name>
<password>DBPASS</password>
</security>
</datasource>
```

Additional data source configuration settings may be necessary depending on your setup. Documentation on those additional configuration settings can be found [here](http://docs.jboss.org/jbossas/docs/Administration_And_Configuration_Guide/5/html/ch13s13.html).

### 3.3. Database Type
Expand All @@ -101,6 +115,7 @@ Valid values for the **apicurio.hub.storage.jdbc.type** property include:
* h2
* mysql5
* postgresql9
* azuresql

One example of how to configure this property is to add the following markup to the **standalone-apicurio.xml** configuration file (after the **<extensions>** section):

Expand All @@ -118,6 +133,13 @@ One example of how to configure this property is to add the following markup to
</system-properties>
```

#### AzureSQL
```xml
<system-properties>
<property name="apicurio.hub.storage.jdbc.type" value="azuresql" />
</system-properties>
```

### 3.4. Initialize Database
If you have chosen to utilize the DDL to initialize the database, then you want to make sure that Apicurio Studio doesn't try to do that when it starts up (which it will do by default). To disable the DB initialization on startup, you must set either an environment variable or system property.

Expand Down
Loading