Old 9th May 2016, 23:51   #1
pkonduru
Member
 
Join Date: Jul 2015
Posts: 62
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 is offline   Reply With Quote
Old 10th May 2016, 08:56   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
Only nsExec::ExecToStack pushes two things to the stack.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 10th May 2016, 17:06   #3
pkonduru
Member
 
Join Date: Jul 2015
Posts: 62
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
pkonduru is offline   Reply With Quote
Old 10th May 2016, 21:25   #4
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,442
0 usually means success. Maybe a 64-bit path issue? Download Process Monitor and compare the working and failing scenarios...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump