Setting up Datagrip

hacking skills
Author

zenggyu

Published

2018-08-29

Modified

2021-07-06

Abstract
Guidance on setting up a fresh datagrip installation.

Introduction

This is one of a series of posts where I document software configurations for personal reference. This post documents the configurations for DataGrip.

Installation

DataGrip is available as a snap package on Ubuntu, which can be installed using the following command:

sudo snap install --classic datagrip

Configuration

Go to “File” - “Settings” and change the following settings:

  • Keymap
    • Main Menu
      • Edit
        • Redo: Ctrl + Y
        • Find
          • Replace: Ctrl + H
      • View
        • Appearance
          • Quick Documentation: Ctrl + E
      • Code
        • Comment with Line Comment: Ctrl + Shift + C
        • Reformat Code: Ctrl + Shift + F
        • Auto-Indent Lines: Ctrl + Shift + I
  • Editor
    • General
      • Soft-wrap these files: *.md; *.txt; *.rst; *.adoc; *.sql
      • Console
        • Use softwraps in console
    • Font
      • Font: Ubuntu Mono
      • Size: 14
    • Code Style
      • SQL
        • General
          • Case
            • Word Case
              • Keywords: To upper
              • Identifiers: To lower
              • Built-in types: As keywords
              • Aliases: As identifiers
          • Tabs and Indents
            • Tab size: 2
            • Indent: 2
            • Continuation indent: 4

Additional notes

Here is a short tutorial on how to connect to an Oracle 11g database using TNS:

  1. Open the “Data Sources and Drivers” window.
  2. Download the oracle database driver.
  3. Add an Oracle data source.
  4. In the “General” -> “URL” section, choose “TNS” from the drop box.
  5. Specify the TNS file (see below for an example) path in the “TNSADMIN” section, and other necessary information below.

Here is a made-up TNS file:

mydb = 
  (DESCRIPTION = 
    (ADDRESS = (PROTOCOL = TCP)(HOST = 152.126.178.13)(PORT = 1521)) 
    (ADDRESS = (PROTOCOL = TCP)(HOST = 152.126.178.14)(PORT = 1521)) 
    (LOAD_BALANCE = no) 
    (FAILOVER = ON) 
    (CONNECT_DATA = 
      (SERVER = DEDICATED) 
      (SERVICE_NAME = newods1) 
      (FAILOVER_MODE = 
        (TYPE = SELECT) 
        (METHOD = BASIC) 
      ) 
    ) 
  )

where mydb is a TNS name.