473,700 Members | 2,536 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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=OraOL EDB.Oracle;" & _
"Data Source=CD;" & _
"User Id=username;" & _
"Password=passw ord"

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

TIA,

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

Select Case True
Case Err.Number = 0
''logged in fine
Case Instr(Err.Descr iption, "does not exist") > 0
Response.Write "That user doesn't exist."
Case Instr(Err.Descr iption, "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.CreateOb ject("ADODB.Con nection")
objADO.Open TheConnectionSt ringVariableWit hUIDandPwd

Select Case True
Case Err.Number = 0
'''fine, continue
blnContinue = True
Case Instr(Err.Descr iption, "does not exist") > 0
Response.Write "User " & strUsername & " does not exist on our AS/400."
Case Instr(Err.Descr iption, "is not correct") > 0
Response.Write "The password you entered for " & strUsername & " is not
correct. Please go back and try again."
Case Instr(Err.Descr iption, "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**@PlsIGnore TH1sBiTcolinste adman.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=OraOL EDB.Oracle;" & _
"Data Source=CD;" & _
"User Id=username;" & _
"Password=passw ord"

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******* *******@TK2MSFT NGP11.phx.gbl>. ..
I've used code like this before:
On Error Resume Next
Conn4.Open "Provider=OraOL EDB.Oracle;" & _
"Data Source=CD;" & _
"User Id=username;" & _
"Password=passw ord"

Select Case True
Case Err.Number = 0
''logged in fine
Case Instr(Err.Descr iption, "does not exist") > 0
Response.Write "That user doesn't exist."
Case Instr(Err.Descr iption, "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.CreateOb ject("ADODB.Con nection")
objADO.Open TheConnectionSt ringVariableWit hUIDandPwd

Select Case True
Case Err.Number = 0
'''fine, continue
blnContinue = True
Case Instr(Err.Descr iption, "does not exist") > 0
Response.Write "User " & strUsername & " does not exist on our AS/400."
Case Instr(Err.Descr iption, "is not correct") > 0
Response.Write "The password you entered for " & strUsername & " is not
correct. Please go back and try again."
Case Instr(Err.Descr iption, "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
43030
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 simple like if exists ('test') then ---good else --create it
5
10384
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. My problem is due to the 3 requests for password when the connection fails. I can't find any option that allows to ask for password only one time. Has anyone already written a such script?
11
12707
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 read the new date. So process B starts "select ..." but does not get the previously inserted row. The timespan between commit and select is very short. (NOTE: two different sessions are used) Questions: 1.) Does commit when returning from call...
125
15454
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 searches. Scott has heard a lot of hype about DB2 and Oracle and is trying to understand the pros and cons of each product. I'm quite familiar with DB2 but have never used Oracle so I can't make any meaningful comparisons for him. He does not have...
11
10750
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 execute in the database server with better performance? Please advise good references for Oracle stored procedures also. thanks!!
5
5390
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 use the existing tnsnames.ora. The Oracle client is installed and the connection to the Oracle database using tnsping and sqlplus is possible (for the db2instance user). For that I changed the environment for the db2instanceuser and added the...
0
19157
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 pc.. the oracle database is installed locally on my pc... how should i port the whole database (including tables, pl sql, triggers, indexes, etc) to another server after all development/testing is completed? I have tried using toad function (DBA ->...
7
20326
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, if they do not already exist. In terms of ASP/ADO, that would be fine in a SQL Server Sense by a simply ASP/Server-Side JavaScript as such: var cnTemp = Server.CreateObject("ADODB.Connection");
7
59249
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 Oracle? If not is there any other easy way to achieve it? I am using Oracle 10g. I have been searching through google and also in oracle.com but unable to get it out. Thanks, Raghavan alias Saravanan M.
0
8722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9069
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8922
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7805
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6558
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4401
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4654
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2389
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.