On January 27th, this site will be read-only as we migrate to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 30th, when you will be able to use this site as normal.

    Forum Stats

  • 3,889,629 Users
  • 2,269,769 Discussions
  • 7,916,800 Comments

Discussions

Not able to run SQLcl in windows CMD even after setting path in environment variables.

User_ZUUOD
User_ZUUOD Member Posts: 800 Bronze Badge
edited Sep 22, 2020 3:33PM in SQLcl

Hi All,

I have downloaded SQLcl latest version and added C:\sqlcl\bin in the environment variable path but when I open CMD prompt and type SQL to run SQLcl it didn't run and throws an error 'SQL' is not recognized as an internal or external command.

Could you advise what I am missing and why SQLcl is not running from CMD? I am able to run it directly from bin folder even though.

Best Answer

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,785 Bronze Crown
    edited Sep 1, 2020 9:59AM Answer ✓

    What Glen is alluding to is that sql.bat in 19c bin is being picked up, not sql.exe in your seperate sqlcl bin directory which is listed twice in your path AFTER the 19c bin directory, so put c:\installs\sqlcl\bin FIRST, not in the middle and last. That way when you type sql at the command prompt it can look in the c:\installs\sqlcl\bin directory first. So try that.

    For example, at the cmd prompt you can:

    C:\> path=C:\installs\sqlcl\bin;%PATH%

    to set sqlcl dir first, or edit the PATH in system settings etc and put it first instead of middle and last which is what echoing your current pah shows.

Answers

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,785 Bronze Crown
    edited Aug 26, 2020 9:02PM

    Sounds like you haven't set the PATH variable correctly.

    Start a CMD prompt and copy/paste this:

    C:\> echo %PATH:;=&echo.%

    Is the path to sql.exe included in the list?

    For debugging set the PATH variable locally by

    C:\> set path=%PATH%;C:\sqlcl\bin

    (If indeed that is where you installed sqlcl)

    Something else to check, make sure sqlcl was installed properly by navigating to where sql.exe is and executing:

    C:\sqlcl\bin\> sql -v

    Don't forget you also need a compatible version of java jdk installed.

    User_ZUUOD
  • User_ZUUOD
    User_ZUUOD Member Posts: 800 Bronze Badge
    edited Aug 27, 2020 12:36PM

    Thanks for the response but the path is correctly set and sqlcl is running from its folder directly.

    pastedImage_1.png

  • User_ZUUOD
    User_ZUUOD Member Posts: 800 Bronze Badge
    edited Aug 31, 2020 4:39PM

    can someone help here please?

  • Glen Conway
    Glen Conway Member Posts: 859 Gold Badge
    edited Aug 31, 2020 5:28PM
    The syntax of the command is incorrect .

    is very different from

    'sql' is not recognized as an internal or external command, operable program or batch file.

    Maybe try "where sql" to see what else may be getting in the way?

    User_ZUUOD
  • User_ZUUOD
    User_ZUUOD Member Posts: 800 Bronze Badge
    edited Aug 31, 2020 5:34PM

    Nothing comes up -

    pastedImage_0.png

  • Glen Conway
    Glen Conway Member Posts: 859 Gold Badge
    edited Aug 31, 2020 5:54PM

    So clearly it is trying to run sql.bat in the Oracle 19c home.  I still have Oracle 11g XE installed locally, there is no sql.bat in that home, so I have no visibility into what might be in your sql.bat.

    Edit: So try prefixing PATH with the C:\Installs\sqlcl\bin instead of suffixing it.

    User_ZUUOD
  • User_ZUUOD
    User_ZUUOD Member Posts: 800 Bronze Badge
    edited Sep 1, 2020 9:36AM

    Hi Glen,

    Thanks for all the valuable inputs. But I couldn't understand the below point -

    Edit: So try prefixing PATH with the C:\Installs\sqlcl\bin instead of suffixing it.

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,785 Bronze Crown
    edited Sep 1, 2020 9:59AM Answer ✓

    What Glen is alluding to is that sql.bat in 19c bin is being picked up, not sql.exe in your seperate sqlcl bin directory which is listed twice in your path AFTER the 19c bin directory, so put c:\installs\sqlcl\bin FIRST, not in the middle and last. That way when you type sql at the command prompt it can look in the c:\installs\sqlcl\bin directory first. So try that.

    For example, at the cmd prompt you can:

    C:\> path=C:\installs\sqlcl\bin;%PATH%

    to set sqlcl dir first, or edit the PATH in system settings etc and put it first instead of middle and last which is what echoing your current pah shows.