Want to do a tnsping from ASP. Any suggestions?
Who is Participating?

Improve company productivity with a Business Account.Sign Up

jitgangulyConnect With a Mentor Commented:
You should use some simple connection with error checking

on error resume next
conn.Open "Driver={Microsoft ODBC for Oracle};" & _
     "Server=" & Application("dbserver") & ";" & _
     "Database=" & Application("dbdatabase") & ";" & _
     "Uid=" & Application("dbuser") & ";" & _
     "Pwd=" & E2P(Application("dbpass")) & ";"

if err.number <> 0 then
     Response.Write "<br><br><br><br><br><br><br><br><br><br><br><font size=3 face=arial>"
     Response.Write " <p align=center style=color:red><b>Error !!! Unable to connect to Database ! Please contact Help Desk</b></p></font>"
     set conn = nothing
end if
Are you trying to connect to an oracle database through ASP?  I guess I've never heard that term before, but I've been able to connect to oracle through ASP...
2 ways to do it.

1. Use Run method of WSH
Dim oShell
Set oShell = WScript.CreateObject ("") "cmd /K CD C:\ & Dir"
Set oShell = Nothing

2. Go to and download ASPExec and you can run command line programs with that.

2nd method is advisable

tnsping is pinging to Oracle db, works the same way as ping
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

So you can ping the Oracle server to see if it's up?  That's a good idea to do...  :-)

Even you can ping the server through a shell command in your program, how are you going to check what the result is?

- Partha
JOKAuthor Commented:
Don't really care about connecting to the db this way, I know I can do it (since I've done it ;)

Today was the first time I've heard about tnsping. I guess its like ping, but it sees if the oracle service is up and running (like jitganguly said).

Don't know how to check the result 'cuz I don't know much about it yet.
JOKAuthor Commented:
Wonder why I don't just try a simple connection, then look at any error code. Hmmmm
JOKAuthor Commented:
did moreorless what jitganguly suggested. Simple query to a small table that I can run on command. Err tells me if db is ok.
if everythings ok then why 'B' ? Remember this is a free service and I spent some time to solver your problem, don't you think you appreciate my help with some good grading
JOKAuthor Commented:
1) I had the idea already about connecting to the db. I didn't need help with that part of it, but I appreciated the code.
2) coulda actually printed the error message.
3) I am the Help Desk. Why would I contact myself? -granted u didn't know that.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.