473,382 Members | 1,180 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 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 7970
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.