4 Commits
Author SHA1 Message Date
KKlochko 0a36bb1ece Update the version.
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
2023-10-29 16:10:34 +02:00
KKlochko 97b1ddca1a Add the README. 2023-10-29 16:10:16 +02:00
KKlochko 4697c16d14 Add the example of a docker-compose for the database. 2023-10-29 15:56:26 +02:00
KKlochko 57d5f341fd Add the example of a db configuration. 2023-10-29 15:55:55 +02:00
5 changed files with 110 additions and 2 deletions
+91
View File
@@ -0,0 +1,91 @@
# jdbc-hospital-example
This project is a example of using jdbc
The project uses the [Spock Framework Example Project](https://github.com/spockframework/)
## Prerequisites
- JDK 17 or higher
- Maven use `mvnw` wrapper
- Gradle use `gradlew` wrapper
## Building with Gradle
Downloaded files (including the Gradle distribution itself) will be stored in the Gradle user home directory (typically **user_home**`/.gradle`).
Type: test
```shell
./gradlew clean test
```
Type: build
```shell
./gradlew clean build
```
Type: preparation
- create a folder, for example, `project`.
- copy config/db to the folder.
- copy `jdbc_hospital_example-1.0.2.jar` from a release to the folder.
- if you build the application from source, find the file (`jdbc_hospital_example-1.0.2-all.jar`) in `build/libs/`.
- copy docker/docker-compose.yml to the folder.
- turn up the database in the `project/docker`:
```
docker-compose up -d
```
- wait a minute while the database is bootstrapping.
- now you can connect with the application.
Type: run
After the preparation, run the application in the folder, for example, `project`:
```shell
java -jar jdbc_hospital_example-1.0.2.jar
```
## Building with Maven
Downloaded files will be stored in the local Maven repository (typically **user_home**`/.m2/repository`).
Type: test
```shell
./mvnw clean test
```
Type: build
```shell
./mvnw clean package
```
Type: preparation
- create a folder, for example, `project`.
- copy config/db to the folder.
- copy `jdbc_hospital_example-version.jar` from a release to the folder.
- if you build the application from source, find the file in `target/`.
- copy docker/docker-compose.yml to the folder.
- turn up the database in the `project/docker`:
```
docker-compose up -d
```
- wait a minute while the database is bootstrapping.
- now you can connect with the application.
Type: run
After the preparation, run the application in the folder, for example, `project`:
```shell
java -jar jdbc_hospital_example-1.0.2.jar
```
## Author
Kostiantyn Klochko (c) 2023
+1 -1
View File
@@ -4,7 +4,7 @@ plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2' id 'com.github.johnrengelman.shadow' version '7.1.2'
} }
version = "1.0.0" version = "1.0.2"
description = "Example of using jdbc for a hostpital." description = "Example of using jdbc for a hostpital."
application { application {
+3
View File
@@ -0,0 +1,3 @@
JDBC_URL="jdbc:postgresql://localhost:5432/testdb"
JDBC_USER=user
JDBC_PASSWORD=testpassword
+14
View File
@@ -0,0 +1,14 @@
version: '3'
services:
db:
image: postgres:15-alpine
restart: always
volumes:
- ./data:/var/lib/postgresql/data
environment:
POSTGRES_DB: testdb
POSTGRES_USER: user
POSTGRES_PASSWORD: testpassword
ports:
- 5432:5432
+1 -1
View File
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>space.kklochko</groupId> <groupId>space.kklochko</groupId>
<artifactId>jdbc_hospital_example</artifactId> <artifactId>jdbc_hospital_example</artifactId>
<version>1.0.0</version> <version>1.0.2</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>Example of using jdbc for a hostpital.</name> <name>Example of using jdbc for a hostpital.</name>