×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

vbscript insert into a oracle DB using sqlplus

vbscript insert into a oracle DB using sqlplus

vbscript insert into a oracle DB using sqlplus

(OP)
Hi need some help.

I am trying to insert some data into a oracle DB using sqlplus:

' Option Explicit
set WshShell = CreateObject("WScript.Shell")

set oEnv=WshShell.Environment("Process")


Dim WshShell, cmdString, oExec, input

cmdString = "D:\oracle\product\10.2.0\client_1\BIN\sqlplus.exe "user name"/"password"@DBName Insert into schema.tablename(SERVER_NAME, SERVER_IP, ENVIRONMENT, LAST_REBOOT, DATE_PULLED) Values ('testserver','0.0.0.0', 'Name', TO_DATE('04/05/2016 15:31:39', 'MM/DD/YYYY HH24:MI:SS'),sysdate); COMMIT;"
)

Set oExec = WshShell.Exec(cmdString)

there is no error displayed but when I check the db no data is written from this script. Not sure where to go from here.

any ideals?

RE: vbscript insert into a oracle DB using sqlplus

Before (or instead of, during testing) the COMMIT, since you are still in the session that did the insert, try select * from schema.tablename; to see if the data exists during your session. Also, are you sure that errors are displayed automatically or do you need to trap them in the cmdString?

==================================
adaptive uber info galaxies (bigger, better, faster, and more adept than cognitive innovative agile big data clouds)


RE: vbscript insert into a oracle DB using sqlplus

I don't know SQLPlus, but just looking at the vbscript, the line where you are assigning a value to cmdString is malformed. (unescaped double-quotes, extra close paren.)

Just taking a wild guess, but maybe the code below will get you closer?


cmdString = "D:\oracle\product\10.2.0\client_1\BIN\sqlplus.exe username/password@DBName Insert into schema.tablename (SERVER_NAME, SERVER_IP, ENVIRONMENT, LAST_REBOOT, DATE_PULLED) Values ('testserver','0.0.0.0', 'Name', TO_DATE('04/05/2016 15:31:39', 'MM/DD/YYYY HH24:MI:SS'),sysdate); COMMIT;"

Set oExec = WshShell.Exec(cmdString)


Also, make sure you do not have On Error Resume Next in your code, or you will not know about runtime errors you may have.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close