Public Repository

Last pushed: a year ago
Short Description
Apache Derby database
Full Description

Apache Derby database

https://db.apache.org/derby/

Image tags

  opavlova/db-derby

OS: ubuntu:14.04.4
Java version: 1.7
Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre
Apache Derby version: 10.12.1.1
Apache Derby home: /db-derby-10.12.1.1-bin/
Folder with databases: /dbs

Usage

How connect to DB in IntelliJ IDEA, DB created via Dockerfile:

  1. Install docker
    https://docs.docker.com/engine/installation/
    https://docs.docker.com/engine/userguide/

  2. Add Docker support
    https://www.jetbrains.com/help/idea/2016.1/docker.html

  3. Create a new folder and a Dockerfile with the following content there:

    FROM  opavlova/db-derby
    
  4. Create container_settings.json with the binding to port:

    {
    "AttachStdin": true,
    "OpenStdin": true,
    "HostConfig": {
     "PortBindings":{
       "1527/tcp": [{ "HostIp": "0.0.0.0", "HostPort": "1527" }]
     }
    }
    }
    
  5. Correct "HostIp" value in the container_settings.json if needed.

  6. Create a new Docker Run Configuration

     - choose "Docker Deployment" in Run/Debug Configuration dialog
     - add values on the Deployment tab:
                   check Docker server - the installed Docker
                   choose Dockerfile - the created Dockerfile file
                   enter imageName,
                   enter containerName
     - add values on the Container tab:
                   add path to container_settings.json in the "JSON file" field
    
     - press Apply/Ok
    
  7. Run the created Configutarion
    Results are in the Docker View

  8. Create connection to the database in the Database View:

    go to the Database View, add new Data Source
    add URL:  jdbc:derby://172.27.121.11:1527/DOCKERDB
      NB: port value is taken from container_settings.json, "HostPort"
    user=DOCKERDB, password = DOCKERDB
    connect
    

Dockerfile for opavlova/db-derby image:
https://github.com/IdeaUJetBrains/DockerFiles/blob/master/docker-dir/db/Derby

How connect to DB in IntelliJ IDEA, DB created via image in the Docker view:

  1. Go to the Docker View
  2. Start Docker
  3. Select "Docker" item->Call context menu->Pull Image
    Enter "opavlova/db-derby" in the Repositoty field
    Click Ok
    
  4. Select the pulled image in the list of images->Call context menu->Create Container->Create
  5. In the "Create Deployment Configuration" dialog, Container tab:
      Press the button "CLI" for creating json file via command-line interface.
      Enter in the "CLI options" field:
         -p 1527:1527
           (port binding: "-p <connecting-port>:<container-port>")
      Enter the path to a new json file with this PortBinding in the "JSON file" field.
      Press Ok.
    
  6. Press Run configuration
  7. Create a connection to the database in the Database View:

    go to the Database View, add new Data Source
    add URL:  jdbc:derby://172.27.121.11:1527/DOCKERDB
    user=DOCKERDB, password = DOCKERDB
    connect
    
Docker Pull Command
Owner
opavlova