Slow functionality from MS Access using ODBC [message #141833] |
Wed, 12 October 2005 08:13 |
mikgus
Messages: 1 Registered: October 2005 Location: sweden
|
Junior Member |
|
|
I'm totally new here, perhaps you can help me.
I've got a MS Access MDB.file that is making calls to a Oracle 9i DB.
Access connects to Oracle using ODBC.
But the function that is called answers extremely slow.
When I run the script from PL-SQL it is much faster.
How can I communicate with Oracle in a faster way?
My code looks like this
Function AngeTidviaSMS(WO_NO As Long, EMP_NO As String, HOURS As Long) As Boolean
Dim Cn As ADODB.Connection, CPw2 As ADODB.Command,Conn As String
Conn = "UID=UserID;PWD=PassWord;Driver={Microsoft ODBC for Oracle};SERVER=DB2"
Set Cn = New ADODB.Connection
With Cn
.ConnectionString = Conn
.CursorLocation = adUseClient
.Open
End With
Set CPw2 = New ADODB.Command
With CPw2
.ActiveConnection = Cn
.CommandText = "ObjOwner.Package.functionName"
.CommandType = adCmdStoredProc
.Parameters.Append .CreateParameter(, adVarChar, adParamOutput, 2000, 10) 'Ev feltext
.Parameters.Append .CreateParameter(, adVarChar, adParamInput, 60) 'wo_no
.Parameters.Append .CreateParameter(, adVarChar, adParamInput, 60) 'emp_no
.Parameters.Append .CreateParameter(, adVarChar, adParamInput, 60) 'hours
End With
CPw2(1) = WO_NO
CPw2(2) = Format(EMP_NO, ">")
CPw2(3) = HOURS
CPw2.Execute
Is there any other way to do this than above?
If I step the code, everythig goes quickly until the CPw2.execute-row.
/ Mikael
|
|
|