Table of Contents

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