Code Monkey home page Code Monkey logo

db-checko's Introduction

DbChecko

DbChecko is a tool that enables you to connect to the database and execute sql commands from command line. Typical usage is verify if the database is reachable from the client which is on server that has no GUI. Another one is to print simple data from some table.

Build

Download or clone the repo. To build the application you need JDK 8 and Maven 3.6. In the project's root directory run:

mvn clean package

Usage

Usage: dbchecko [-hV] [COMMAND]
  -h, --help      Show this help message and exit.
  -V, --version   Print version information and exit.
Commands:
  check   Checks if it is possible to connect to the database.
  select  Allows you to run a select sql command.
  update  Allows you to run an update sql command.

Check command

Verifies if the database is reachable.

Example Windows:

java -cp target\db-checko.jar;drivers\* DbCheckoApp check -p database.properties

Example Linux:

java -cp target/db-checko.jar:drivers/* DbCheckoApp check -p database.properties

Because check command is the most often usage, there are helper scripts for this command dbchecko.bat/dbchecko.sh.

Select command

Prints simple data from a table.

Example Windows:

java -cp target\db-checko.jar;drivers\* DbCheckoApp select -p database.properties -s "select userid, screenname from user_"

Example Linux:

java -cp target/db-checko.jar:drivers/* DbCheckoApp select -p database.properties -s "select userid, screenname from user_"

JDBC drivers

There are postgresql and mssql JDBC drivers prepared by default. If you need to use other JDBC driver, create drivers directory (if doesn't exist) in the project's root directory and copy your driver here.

Configuration

You can specify connection configuration to your database by one of these options:

Properties file

Use -p option and specify path to properties file. It has to have these properties:

  • jdbc.default.driverClassName - driver's class name
  • jdbc.default.url - a database connection URL
  • jdbc.default.username - a username used to login
  • jdbc.default.password - a password used to login

Tomcat context file

Use -c option and specify path to tomcat context file. It has to have Resource with name jdbc/LiferayPool.

Distributable package

To create a distributable zip package which you can upload wherever you want, use dist profile:

mvn clean package -P dist

db-checko's People

Contributors

raptor22fa avatar

Stargazers

Ales Rybak avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.