Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > How do I check to see if Oracle SID Exists?

Reply
Thread Tools

How do I check to see if Oracle SID Exists?

 
 
Colin Steadman
Guest
Posts: n/a
 
      12-17-2003
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
 
Reply With Quote
 
 
 
 
Ray at
Guest
Posts: n/a
 
      12-17-2003
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" <(E-Mail Removed)> wrote in message
news:05ed01c3c4c0$155bf9a0$(E-Mail Removed)...
> 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



 
Reply With Quote
 
 
 
 
Colin Steadman
Guest
Posts: n/a
 
      12-18-2003
"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message news:<(E-Mail Removed)>...
> 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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
I can see the Oracle database but I cant see the tables. Steve Kershaw ASP .Net 1 09-26-2006 04:19 PM
Can convert group SID to name Isky ASP .Net 0 12-01-2005 01:14 PM
install_driver(Oracle) failed: Can't load 'C:/Perl/site/lib/auto/DBD/Oracle/Oracle.dll' for module DBD::Oracle: load_file:The specified procedure could not be found at C:/Perl/lib/DynaLoader.pm line 230. Feyruz Perl Misc 4 10-14-2005 06:47 PM
Access denied attempting to launch a DCOM Server. The server is: {000C101C-0000-0000-C000-000000000046} The user is ASPNET/ServerName, SID=S-1-5-21-1606980848-602162358-1801674531-1007. c.verma@gmail.com ASP .Net 0 05-26-2005 08:44 PM



Advertisments