/run-query

Primary LanguageJavaApache License 2.0Apache-2.0

Query executor

A small application to run queries against a database.

JVM-Mode

Application

Building the application
./mvnw --define build-container-image clean verify

Starting the environment and testing the application

Starting the image
docker-compose \
  --file local-deployment/docker-compose.yml \
  --profile serivce \
  up \
  --detach

To test the application, execute

Execute query SELECT 1=1;
$ curl \
  'http://localhost:8080/run-query?query=SELECT%201%3D1%3B' \
  --verbose
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /run-query?query=SELECT%201%3D1%3B HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< content-length: 0
<
* Connection #0 to host localhost left intact

The status-code will be 200, indicating the query executed successfully. If a query fails, the status code will be 400.

Stopping the environment

Stopping the container
docker-compose \
  --file local-deployment/docker-compose.yml \
  --profile service \
  down

Native mode

Application

Build a container image
./mvnw \
  --define native \
  --define build-container-image \
  clean package

The resulting image will be named de.turing85/run-query:latest and de.turing85/run-query:native

Starting the environment and testing the application

Starting the image
docker-compose \
  --file local-deployment/docker-compose.yml \
  --profile native-serivce \
  up \
  --detach

To test the application, execute

Execute query SELECT 1=1;
$ curl \
  'http://localhost:8080/run-query?query=SELECT%201%3D1%3B' \
  --verbose
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /run-query?query=SELECT%201%3D1%3B HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.81.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< content-length: 0
<
* Connection #0 to host localhost left intact

The status-code will be 200, indicating the query executed successfully. If a query fails, the status code will be 400.

Stopping the environment

Stopping the container
docker-compose \
  --file local-deployment/docker-compose.yml \
  --profile native-service \
  down

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Marco Bungart
Marco Bungart

💻 🚧 📖