Skip to content
⌘ NSIS Forum Archive

Oracle connection test

4 posts

pkonduru#

Oracle connection test

Hi all,

I tried searching around but could not find a solution to test an oracle connection in the forums. This is what I tried doing so far:
--On the command line this works:
"sqlplus user\pwd@SID"

I am trying to run this using nsExec(all the three parameters are variables)
nsExec::Exec "sqlplus $user/$pwd@$SID"
Pop $0
Pop $1
$0 has "1"
$1 has some random number like "13390"

Is there anyway from the output I can tell connection has been successful ? I tried writing to a log file and that works

nsExec::Exec "cmd /C sqlplus $user/$pwd@$SID > C:\sqltest.log"

Any other way to test this without having to write to a log file?

--Pavan
pkonduru#
Thanks Anders. When I use ExecToStack, there are my outputs:

$0 :"1"
$1-
SQL*Plus: Release 11.2.0.3.0 Production on Tue May 10 12:45:58 2016

Copyright (c) 1982, 2011, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>Error 45 initializing SQL*plus
Internal error

I don't get this error when I run the same command from command line:

sqlplus $username\$pwd@SID

Should I rely on the output of $0 sice it gives me 1 for a successful connection and 0 for invalid credentials?
My installer would also need to run some sql scripts and capture the output. Is there any good practices or links for this?

--Pavan
Anders#
0 usually means success. Maybe a 64-bit path issue? Download Process Monitor and compare the working and failing scenarios...