SQL - SQLLine (SQL at the command line)

Data System Architecture

About

SQLLine is a java command line tool client

Example

Execute a query and quit

  • Against a SQL Server database
 sqlline -u "jdbc:sqlserver://hostName.database.windows.net:1433;databaseName=dbName" -n login -p 'password' -e "select 1"

where:

  • -u <database url> the JDBC URL to connect to
  • -n <username> the username to connect as
  • -p <password> the password to connect as
  • -d <driver class> the driver class to use
  • -e <command>

Testing connectivity with Ansible

- name: Testing the JDBC connectivity
    command: "{{ sqlline_home }}/sqlline -u 'jdbc:sqlserver://{{ infa_db_endpoint }}:{{ infa_db_port }};databaseName={{ infa_domain_db_name }}' -n '{{ infa_db_user }}' -p '{{ infa_db_password }}' -e 'select 1'"
    register: jdbc_test_result
    changed_when: "jdbc_test_result.rc != 0"
    failed_when: "jdbc_test_result.rc != 0"

Quit

  • !quit to quite

Documentation / Reference





Discover More
Card Puncher Data Processing
Db - Client

Database client use an ODBC or JDBC connection to be able to connect to the most database. GUI Squirel is a Java based (JDBC) SQL client. Quick...
Card Puncher Data Processing
Hive - Beeline

Beeline is a JDBC client that is based on the SQLLine CLI The Beeline shell works in both embedded mode as well as remote mode. bash beeline with connect beeline URL in environment variable...
Card Puncher Data Processing
Hive - Variable (hivevar)

Hive variables are variables that can be set at the session level and referenced in Hive commands or queries. --hivevar options hivevar Example with and a URL Select with substituion...
Card Puncher Data Processing
Hive - Variable Substitution

in Hive. substitution can be used in Hive commands or queries. Type Substitution Configuration variable System Env conf...



Share this page:
Follow us:
Task Runner