-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arnold Somogyi
committed
Aug 4, 2020
1 parent
acb683b
commit ec6e67d
Showing
2 changed files
with
21 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,26 @@ | ||
# TODO: this content needs to be updated and finished | ||
# Remal SQL-Runner command line tool | ||
|
||
> [Release Note](release.md) | ||
_keywords: java, sql, query, insert, select, update, oracle, database, bash script, shell script, command line, tool, execute, automate, docker_ | ||
|
||
_[Release Note](release.md)_ | ||
|
||
## 1) Overview | ||
The tool can be used from Windows/Linux script files. | ||
The SQL-Runner is a flexible command line Java tool can be used to run any SQL commands using bash script and command line. It can be used very effectively from Windows/Linux script files. | ||
|
||
The latest version of the tool only supports Oracle Database server, but it can support different SQL dialects as well. | ||
|
||
## 2) Use cases | ||
#### 2.1) Database status check | ||
A possible use case in Docker environment is to check whether the database server is ready to receive incoming connections or not: | ||
~~~ | ||
#!/bin/bash | ||
until java -jar sql-runner-1.0-with-dependencies.jar -j jdbc:oracle:thin:@//oracle-db:1521/ORCLPDB1.localdomain -U "SYS as SYSDBA" -P Oradoc_db1 "select 1 from dual" | ||
until java -jar sql-runner-0.2.0-with-dependencies.jar -j jdbc:oracle:thin:@//oracle-db:1521/ORCLPDB1.localdomain -U "SYS as SYSDBA" -P Oradoc_db1 "select 1 from dual" | ||
do | ||
echo "The database server in not up and running. Waiting..." | ||
# sleep 0.5 | ||
sleep 0.5 | ||
done | ||
echo ok | ||
echo "Database server is up and running" | ||
~~~ | ||
|
||
## 3) Usage | ||
|
@@ -50,11 +53,15 @@ Provide a JDBC URL: | |
-j, --jdbcUrl=<jdbcUrl> JDBC URL, example: jdbc:oracle:<drivertype>:@//<host>:<port>/<database>. | ||
Exit codes: | ||
1 Successful program execution. | ||
2 An unexpected error appeared while executing the SQL statement. | ||
3 Usage error. User input for the command was incorrect. | ||
0 Successful program execution. | ||
1 An unexpected error appeared while executing the SQL statement. | ||
2 Usage error. User input for the command was incorrect. | ||
Please report issues at [email protected]. | ||
Documentation, source code: https://github.com/zappee/sql-runner.git | ||
~~~~ | ||
|
||
## 4) Examples | ||
* `java -jar target/sql-runner-1.0-with-dependencies.jar -j jdbc:oracle:thin:@//localhost:1521/ORCLPDB1.localdomain -U "SYS as SYSDBA" -P "Oradoc_db1" "select * from SCHEMA.TABLE"` | ||
* `java -jar target/sql-runner-1.0-with-dependencies.jar -h localhost -p 1521 -d ORCLPDB1.localdomain -U "SYS as SYSDBA" -P "Oradoc_db1" "select * from SCHEMA.TABLE"` | ||
## 4) Licence | ||
BSD (2-clause) licensed. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters