Forum Stats

  • 3,758,196 Users
  • 2,251,352 Discussions
  • 7,870,106 Comments

Discussions

Cannot connect with SQLcl 18.1.1

Earl Lewis
Earl Lewis Member Posts: 2,150 Bronze Badge
edited Jun 5, 2018 11:12PM in SQLcl

Just downloaded SQLcl 18.1.1 today and can't get it to connect to my databases. The database is an Exadata cluster and I have production and development instances setup in tnsnames.ora. I'm consistently getting the following error.

SQL> conn [email protected]? (**********?) **********  USER          = u0363644  URL           = jdbc:oracle:oci8:@prod  Error Message = Could not initialize class oracle.jdbc.OracleDriver  USER          = u0363644  URL           = jdbc:oracle:thin:@(DESCRIPTION =    (ADDRESS_LIST =      (LOAD_BALANCE = on)      (ADDRESS = (PROTOCOL = TCP)(HOST = changed.to.fool.you.1)(PORT = 2080))      (ADDRESS = (PROTOCOL = TCP)(HOST = changed.to.fool.you.2)(PORT = 2080))    )    (CONNECT_DATA =      (SERVICE_NAME = papr)    )  )  Error Message = Could not initialize class oracle.jdbc.OracleDriverJun 01, 2018 2:35:10 PM oracle.dbtools.raptor.newscriptrunner.ScriptExecutor runSEVERE: oracle.dbtools.raptor.scriptrunner.commands.NLSLANGListener.setLanguage(NLSLANGListener.java:86)java.lang.NullPointerException    at oracle.dbtools.raptor.scriptrunner.commands.NLSLANGListener.setLanguage(NLSLANGListener.java:86)    at oracle.dbtools.raptor.scriptrunner.commands.NLSLANGListener.runOnConnect(NLSLANGListener.java:52)    at oracle.dbtools.raptor.scriptrunner.commands.NLSLANGListener.endEvent(NLSLANGListener.java:102)    at oracle.dbtools.raptor.newscriptrunner.CommandRegistry.fireEndListeners(CommandRegistry.java:564)    at oracle.dbtools.raptor.newscriptrunner.ScriptRunner.run(ScriptRunner.java:297)    at oracle.dbtools.raptor.newscriptrunner.ScriptExecutor.run(ScriptExecutor.java:342)    at oracle.dbtools.raptor.newscriptrunner.ScriptExecutor.run(ScriptExecutor.java:225)    at oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli.process(SqlCli.java:398)    at oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli.processLine(SqlCli.java:409)    at oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli.startSQLPlus(SqlCli.java:1235)    at oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli.main(SqlCli.java:485)

Using the same TNS file and attempting to connect through SQLcl Release 4.2.0.16.049.0842 RC it works just fine. Anyone have any idea what might be going on here? Is this a bug in the new version?

Earl

Answers

  • Quanwen Zhao
    Quanwen Zhao Member Posts: 584 Blue Ribbon
    edited Jun 3, 2018 12:12AM

    Hello, Earl Lewis

    How do you set your .bash_profile on Oracle user?

    Maybe $ORACLE_HOME conflicts with $JAVA_HOME, you can use '#' to cancel that line of ORACLE_HOME and retry it again.

    Best Regards

    Quanwen Zhao

    https://quanwenzhao.wordpress.com

    Update (Jul 03, 2018):

    Although canceling $ORACLE_HOME in .bash_profile on Oracle user, I don't think that it's a good workaround because a series of oracle command (such as sqlplus, rman, lsnrctl ...) don't conveniently use.

    The best solution trouble-shooting this issue is that you could install SQLcl 18.1.1 to another OS user SQLCL (If so, $JAVA_HOME (from user SQLCL) doesn't conflict with $ORACLE_HOME/jdk (from user ORACLE).

    The following is several operation steps,

    [[email protected] ~]$ cd /usr/java/[[email protected] java]$ ls -lrhttotal 4.0Kdrwxr-xr-x 9 sqlcl sqlcl 4.0K Jun  1 13:43 jdk1.8.0_172-amd64lrwxrwxrwx 1 sqlcl sqlcl   28 Jun  1 13:43 latest -> /usr/java/jdk1.8.0_172-amd64lrwxrwxrwx 1 sqlcl sqlcl   16 Jun  1 13:43 default -> /usr/java/latest

    [[email protected] ~]$ id sqlcluid=501(sqlcl) gid=503(sqlcl) groups=503(sqlcl)[[email protected] ~]$ [[email protected] ~]$ cat .bash_profile # .bash_profile# Get the aliases and functionsif [ -f ~/.bashrc ]; then        . ~/.bashrcfi# User specific environment and startup programsPATH=$PATH:$HOME/binexport PATHexport JAVA_HOME=/usr/java/jdk1.8.0_172-amd64export SQLCL_HOME=/home/sqlcl/sqlclexport CLASS_PATH=$JAVA_HOME/lib:$SQLCL_HOME/lib:$CLASS_PATHexport PATH=$JAVA_HOME/bin:$SQLCL_HOME/bin:$PATH

    [[email protected] ~]$ sql test/[email protected]:1530/testSQLcl: Release 18.1.1 Production on Sun Jun 03 12:08:54 2018Copyright (c) 1982, 2018, Oracle.  All rights reserved.Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit ProductionWith the Partitioning, Oracle Label Security, OLAP, Data Mining,Oracle Database Vault and Real Application Testing optionsSQL> 
  • Gaz in Oz
    Gaz in Oz Member Posts: 3,782 Bronze Crown
    edited Jun 5, 2018 11:12PM
    $ cat sql#!/bin/bashexport TNS_ADMIN=/u01/tns # requires exporting.export ORACLE_HOME=export ORACLE_BASE=export ORACLE_SID=export CLASSPATH=PATH=$(echo "/usr/local/bin:                                \             /bin:                                          \             /usr/bin:                                      \             /usr/local/sbin:                               \             /usr/sbin:                                     \             /sbin:                                         \             /home/oracle/Downloads/sqlcl-18.1.1/sqlcl/bin: \             /opt/jdk1.8.0_102/bin:                         \             /opt/jdk1.8.0_102/jre/bin                    " | sed -e 's/[ \n]\{1,\}//g')sql -noupdates -l $*

    ...for example, using the bash shell. (Why don't connect to my Oracle DB via SQLcl 18.1.1 )

    Note: If you choose to copy/paste the sql shell script from above, make sure you don NOT have trailing spaces after the "\" line continuation characters in your script.

    $ ./sql gaz/[email protected]: Release 18.1.1 Production on Wed Jun 06 13:12:55 2018Copyright (c) 1982, 2018, Oracle.  All rights reserved.Last Successful login time: Wed Jun 06 2018 13:13:01 +10:00Connected to:Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit ProductionSQL>