472,373 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,373 software developers and data experts.

How do I check to see if Oracle SID Exists?

I have built a page that lists all our databases, the
users connected to each database, and what application
they are using. Because these databases are moved, or
removed from time to time I need to check if the database
still exists before trying to query it. Otherwise I get
funny SID errors when it tries to process this command:-

Conn4.Open "Provider=OraOLEDB.Oracle;" & _
"Data Source=CD;" & _
"User Id=username;" & _
"Password=password"

Can this be done in ASP or should I be querying the error
collection or something?

TIA,

Colin
Jul 19 '05 #1
2 7905
I've used code like this before:
On Error Resume Next
Conn4.Open "Provider=OraOLEDB.Oracle;" & _
"Data Source=CD;" & _
"User Id=username;" & _
"Password=password"

Select Case True
Case Err.Number = 0
''logged in fine
Case Instr(Err.Description, "does not exist") > 0
Response.Write "That user doesn't exist."
Case Instr(Err.Description, "some other error string") > 0
Response.Write "Some other error that you'd like the user to see."
End Select
On Error Goto 0
My actual code:

Set objADO = Server.CreateObject("ADODB.Connection")
objADO.Open TheConnectionStringVariableWithUIDandPwd

Select Case True
Case Err.Number = 0
'''fine, continue
blnContinue = True
Case Instr(Err.Description, "does not exist") > 0
Response.Write "User " & strUsername & " does not exist on our AS/400."
Case Instr(Err.Description, "is not correct") > 0
Response.Write "The password you entered for " & strUsername & " is not
correct. Please go back and try again."
Case Instr(Err.Description, "has been disabled") > 0
Response.Write strUsername & " is disabled on the AS/400 and will need to
be reset."
Case Else
Response.Write "An unknown error has occurred. Sorry about that."
End Select
Ray at work
"Colin Steadman" <ms**@PlsIGnoreTH1sBiTcolinsteadman.com> wrote in message
news:05****************************@phx.gbl...
I have built a page that lists all our databases, the
users connected to each database, and what application
they are using. Because these databases are moved, or
removed from time to time I need to check if the database
still exists before trying to query it. Otherwise I get
funny SID errors when it tries to process this command:-

Conn4.Open "Provider=OraOLEDB.Oracle;" & _
"Data Source=CD;" & _
"User Id=username;" & _
"Password=password"

Can this be done in ASP or should I be querying the error
collection or something?

TIA,

Colin

Jul 19 '05 #2
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message news:<Or**************@TK2MSFTNGP11.phx.gbl>...
I've used code like this before:
On Error Resume Next
Conn4.Open "Provider=OraOLEDB.Oracle;" & _
"Data Source=CD;" & _
"User Id=username;" & _
"Password=password"

Select Case True
Case Err.Number = 0
''logged in fine
Case Instr(Err.Description, "does not exist") > 0
Response.Write "That user doesn't exist."
Case Instr(Err.Description, "some other error string") > 0
Response.Write "Some other error that you'd like the user to see."
End Select
On Error Goto 0
My actual code:

Set objADO = Server.CreateObject("ADODB.Connection")
objADO.Open TheConnectionStringVariableWithUIDandPwd

Select Case True
Case Err.Number = 0
'''fine, continue
blnContinue = True
Case Instr(Err.Description, "does not exist") > 0
Response.Write "User " & strUsername & " does not exist on our AS/400."
Case Instr(Err.Description, "is not correct") > 0
Response.Write "The password you entered for " & strUsername & " is not
correct. Please go back and try again."
Case Instr(Err.Description, "has been disabled") > 0
Response.Write strUsername & " is disabled on the AS/400 and will need to
be reset."
Case Else
Response.Write "An unknown error has occurred. Sorry about that."
End Select
Ray at work

Aha! That does the trick.

Thanks for sharing.

Colin
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: DottingTheNet | last post by:
i promise no more silly questions after this but how do i check if a table exists?? it is my understanding that the exists can only be used in the where clause of the query. i just want s'thing...
5
by: F. Biguet | last post by:
Hello, I want to create a generic script that connects to Oracle databases (from 7.3.4 to 9.2 version) with a guest user. This script should return 1 if connection is successful and 0 if not....
11
by: Markus Breuer | last post by:
I have a question about oracle commit and transactions. Following scenario: Process A performs a single sql-INSERT into a table and commits the transaction. Then he informs process B (ipc) to...
125
by: Rhino | last post by:
One of my friends, Scott, is a consultant who doesn't currently have newsgroup access so I am asking these questions for him. I'll be telling him how to monitor the answers via Google Newsgroup...
11
by: jrefactors | last post by:
I want to know the differences between SQL Server 2000 stored procedures and oracle stored procedures? Do they have different syntax? The concept should be the same that the stored procedures...
5
by: Michael Rudolph | last post by:
Hi newsgroup, I have an issue with the configuration of a DB2 federated database (WebSphere Information Integrator) in conjunction with the relational wrapper for Oracle on AIX. DB2 seems to not...
0
by: jen78 | last post by:
Hi, I am new to Oracle administration and hope someone can help me out on this as i am struggling to make it work.... I am doing development work using oracle database on my own development...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Run multiple SQL statements from ASP/ADO to an Oracle 10g. Please help, I'm trying to write an ASP page to use ADO to run a long query against an Oracle 10g database, to create tables,...
7
by: itsraghz | last post by:
Hello All, I remember in MySQL we do have "IF EXISTS", 'IF NOT EXISTS" clause/keyword in the DDL statements (CREATE,DROP etc.,) to avoid unnecessary bombing. Do we have such facility in...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
2
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.