Skip to Main Content

SQLcl: MCP Server & SQL Prompt

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Getting started in Linux

partlycloudyOct 29 2018 — edited Oct 30 2018

sqlcl looks very interesting so I went to the download page and unzipped the folder on a Linux server. This server currently has the Oracle 12.1 client installed, tnsnames.ora is used to locate databases, sqlplus works.

But I can't figure out how to get bin/sql to work

Help? Thanks

$echo $0

-bash

$type java

java is hashed (/app/oracle/client/product/12.2.0/client_1/jdk/bin/java)

$java -version

java version "1.8.0_91"

Java(TM) SE Runtime Environment (build 1.8.0_91-b14)

Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

./sql

$./sql

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load library. Reasons: [no jansi in java.library.path, /tmp/libjansi-64-2291100768859576172.so: /tmp/libjansi-64-2291100768859576172.so: failed to map segment from shared object: Operation not permitted]

        at org.fusesource.hawtjni.runtime.Library.doLoad(Library.java:182)

        at org.fusesource.hawtjni.runtime.Library.load(Library.java:140)

        at org.fusesource.jansi.internal.CLibrary.<clinit>(CLibrary.java:42)

        at org.fusesource.jansi.AnsiConsole.wrapOutputStream(AnsiConsole.java:48)

        at org.fusesource.jansi.AnsiConsole.<clinit>(AnsiConsole.java:38)

        at oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli.main(SqlCli.java:435)

This post has been answered by floo_bar on Oct 30 2018
Jump to Answer

Comments

NickR2600-Oracle

Sounds like you might be interested in Java Regular Expressions (regex) and pattern matching.  I've found regular expressions useful for formatting and searching Strings and numbers. There is a tutorial from Oracle (https://docs.oracle.com/javase/tutorial/essential/regex/ ).  I've also had luck googling for regular expression examples, since there's so many tricks, options, characters to keep track of.

mNem
Answer

I am using something like the one below. I don't know if that is going to help in

I am interested in tidying up the output to do the following:

  1. Strings and value in two separate columns (???)

 

public void printDetails() {

      System.out.println(String.format("Account Owner: %s", accountOwner));

      System.out.println(String.format("Account Type: %s", accountType));

      DecimalFormat df = new DecimalFormat("$ #,##0.00");

      String formattedBal = df.format(balance);

      System.out.println(String.format("Balance for customer [%s]:  %s", accountOwner, formattedBal));

}

Marked as Answer by OTG-467455 · Sep 27 2020
1 - 2

Post Details

Added on Oct 29 2018
7 comments
759 views