Click to See Complete Forum and Search --> : Beginner:Problem CreateObject in ASP
roscd
Feb 27th, 2001, 11:55 PM
I'm putting my asp page in IIS running NT4.0. My problem is when 2 or more client try
to access this page at the same time, some of them failed to execute CreateObject but if user accessing
this page sequentialy, no error occurs. Can someone help me how to solve this problem, maybe IIS setting, ActiceX DLL setting, NT setting... ?
jdavison
Feb 28th, 2001, 10:29 AM
what object are you trying to create and what does it do?
nybble
Feb 28th, 2001, 07:25 PM
you are closing the object when you are done, right?
jdavison
Feb 28th, 2001, 08:59 PM
That should cause a problem, just eat up memory. I have forgoten to close objects before and it still always works even simultaniously.
Does this object connect to a db or what?
roscd
Mar 1st, 2001, 04:29 AM
Yes i am creating an object that will connected to database, query some data and return back to the caller. Yes, I am closing the object after finish it. Can u advise me... how to handle this problem...
jdavison
Mar 1st, 2001, 08:21 AM
if your connecting to an access db your kinda out of luck. It will only allow one connection in at a time to a table. Part of why i dont like using access on big sites which is what i am trying to convince them of here.
nybble
Mar 1st, 2001, 01:49 PM
the db should only be open for a split second, if its giving you errors then its not closing right.
jdavison
Mar 1st, 2001, 01:53 PM
it stay open as long as it take to run the command text. That is usually longer than a split second through asp. Its not the same as running it through access itself, it takes a bit longer.
nybble
Mar 1st, 2001, 01:57 PM
i actually am running under the same situation and i never have a problem with creatingobjects.
strConnection = "DSN=newhire;Database=newhire;UID=sa;PWD=;"
objConn.Open strConnection
strQuery = "SELECT lname, password, department FROM users WHERE lname = '" & Request.QueryString("lname") & "'"
Set objRS = objConn.Execute(strQuery)
While Not objRS.EOF
dept = ObjRS("department")
objRS.MoveNext
Wend
objRS.close
set objRS = Nothing
i do that, and then i redefine objRS, do another query, close it... and then close objConn, and set it to nothing.
nybble
Mar 1st, 2001, 02:01 PM
another thing, are you using a DSN database? RDS? what does your connect string look like?
jdavison
Mar 1st, 2001, 02:29 PM
what com object r you using roscd and what does it do. Is it a custom object?
from what he described and my current understanding, he has a com object he created. he is not using straight ado in his asp code. so the situation would not be the same.
roscd
Mar 1st, 2001, 10:01 PM
I think there is no problem accessing multiple connection to database because I'm using db on SQL Server 7.0 running on NT 4.0. The problem is when concurrent user acessing this page, system failed to create an object before any operation continue. Thats mean connection is not a problem but creating an object is one of them.
Below is my connection string and how I open it
-------------------------------------------------------------
strConnect=Provider=SQLOLEDB;Data Source=mysqlsvr;Initial Catalog=StudentDB;UID=sa;PWD=;
conConnection.Open strConnect
With rstData
'set cursor location
.CursorLocation = adUseClient
'read info into r'set
.Open strSQL, conConnection, adOpenStatic, adLockBatchOptimistic, adCmdText
'd'connect r'set
Set .ActiveConnection = Nothing
End With
'close d'base connection
conConnection.Close
ASP page which is failed when concurrent user access
--------------------------------------------------------------------
<%RSDispatch%>
<SCRIPT RUNAT=SERVER Language="javascript">
<!--#INCLUDE FILE="_ScriptLibrary/RS.ASP"-->
//*****************************************************************
// Routine :
// This function getValue from FirstPage page and pass the value
// into this page and this function will get the parameter and send
// it to vbScript
//*****************************************************************
var public_description = new Description();
function Description()
{
this.Method1 = Function('varToken','URL','return getTokenValue(varToken,URL)');
}
</SCRIPT>
<script runat=server Language="VBScript">
'**********************************************************************
' This function is to get student information based from token no
' and combined all the student information into string format and
' return string value to TNL application
'**********************************************************************
Dim objAssign,objFirstPage,objName
Dim rstAssign,rstFirstPage,rstName
Function getTokenValue(TokenNo,URL)
'Initialize objAssign business object
Dim objGetRef
Dim objStudentAssgmtUS
Dim strReturnString
Dim ErrorString
If len(trim(URL)) =0 then
ErrorString ="Failed:URL was not received"
End If
If len(trim(TokenNo))=0 then
ErrorString =ErrorString & "Failed:Token was not received"
End If
If len(trim(TokenNo))<>38 then
If len(Tokenno) <>1 then
ErrorString =ErrorString & "Failed:Invalid Token was Passed"
End If
End If
If len(ErrorString)>0 Then
'Set the status
ErrorString = "FAILED:" & ErrorString
Else
If TokenNo = "1" Then
'Set the status
ErrorString = "PASSED : " & TokenNo & "*" & URL & "*NULL*NULL*NULL*NULL*U*NULL*##"
Else
'*************THIS IS WHERE SYSTEM FAILED TO CREATE AN OBJECT WHEN CONCURRENT USER ACCESSING PAGE****************************
Set objGetref = Server.CreateObject("AssignmentUSM.clsERStudentAssgmtUS")
'*************************************************************************************************** ****
Set objStudentAssgmtUS = objGetRef.GetRef
Set objGetRef = Nothing
Dim SchoolID
Dim SessionID
Dim ConnectionStr
Dim objSystemMain
Dim objSystem
Dim objWebSystem
Set objSystemMain = Server.CreateObject("SystemUSS.clsSystemUS")
Set objSystem = objSystemMain.GetRef
Set objWebSystem = Server.CreateObject("WebSystemBSM.clsWebSystemBS")
ConnectionStr = objSystem.GetSetting("SSMS","ConnectionString")
SchoolID = objWebSystem.GetSchoolID
SessionID = 1
Set objSystemMain = Nothing
Set objSystem = Nothing
Set objWebSystem = Nothing
objStudentAssgmtUS.intSchoolID = SchoolID
objStudentAssgmtUS.lngsessionID = SessionID
objStudentAssgmtUS.strModulename = "PA"
objStudentAssgmtUS.strConnectionstring = ConnectionStr
strReturnString = objStudentAssgmtUS.RetrieveByTokenNo(TokenNo,URL)
'Terminate the object
Set objStudentAssgmtUS =nothing
'Set the status
ErrorString = "PASSED : " & strReturnString
End If
End If
'Return the status
getTokenValue = ErrorString
End Function
</SCRIPT>
roscd
Mar 1st, 2001, 10:21 PM
I also try to create ASP page and dummy ActiveXDLL which is not running any process on it. Same error came out when conncurrent user accessing page and try to create that object. How can this happen....
If one user or sequentialy access this page. No problem happen.
monte96
Mar 2nd, 2001, 01:04 AM
Check permissions on the server.
Also check if you are limited to one connection to the DB at a time.
roscd
Mar 3rd, 2001, 11:55 PM
How can I check db connection user connection limit. Is it base on SQL server user license or NT user license.
nybble
Mar 5th, 2001, 01:45 PM
the NT license could limit how many users u have... but it would definetly be more than 2. it could very well be within the SQL Server, just look through all the help files and configurations and look for anything that would explain a limiting of connections
monte96
Mar 5th, 2001, 09:01 PM
I meant a setting in SQL Server that limits the number of concurrent connections by the same user (since the web server is always the same user). Not a license.
roscd
Mar 6th, 2001, 08:05 PM
Thanks monte....
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.