If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Double Oracle Connections

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-06-03, 02:32
radar radar is offline
Registered User
 
Join Date: Feb 2003
Posts: 1
Double Oracle Connections

Hi,

I am accessing and Oracle 8.05 database from an ASP. My problem is that it is doing double connections. This causes an error on SQL inserts with duplciate keys, as the first one inserts fine, but then it tries to do it a second time and I get a "duplicate key" error.

The code is as follows:

<DB Code in include file>
Dim mConn

Function OpenConnection()
Set mConn = CreateObject("ADODB.Connection")
mConn.Open "Provider=MSDAORA; Data Source=test; User ID=user;
Password=password"
End Function

Function CloseConnection()
mConn.Close
Set mConn = Nothing
End Function

Function GetRecordset(pstrSQL)
Set GetRecordset = CreateObject("ADODB.Recordset")
Set GetRecordset = mConn.Execute(pstrSQL)
End Function

<Where this code is called>
Dim rsUser, strSQL, flAccessAllowed

OpenConnection()

strSQL = "select user_id from users where user_id = UPPER('" & strUser
& "')"

Set rsUser = GetRecordset(strSQL)
If not rsUser.bof and not rsUser.eof then
flAccessAllowed = true
end if

rsUser.close
Set rsUser = nothing

strSQL = ""
CloseConnection()

There's no problem when "strSQL" is a select. When "strSQL" is an insert statement, this is where the error occurs. Has anyone seen this before and/or know why it is happening? I can look at the active sessions through Toad and it always creates two connections, even for just the above select.


Thanks.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On