I am trying to execute a PLSQL UTL_FILE command through an ASP.NET web app and keep encountering this error;
[Oracle][ODBC]Syntax error or access violation.
I am passing in a string (filename) into the sql (insql) and using the below code to execute the command. Note - I pass the sql string and an sql type (1 - UPDATE, 2 - UTL_FILE) into the sub SqlConn;
Public Sub SqlConn(insql, sql_type)
Dim cn As New ADODB.Connection
cn.ConnectionString = "Driver=[Microsoft driver for Oracle];Data Source=[Name];Persist Security Info=True;User ID=UID;Password=PWD"
cn.ConnectionTimeout = 900
cn.Open()
If sql_type = 1 Then
Dim rs As New ADODB.Recordset()
Dim da As New OleDbDataAdapter()
Dim ds As New DataSet()
With rs
.CursorLocation = ADODB.CursorLocationEnum.adUseClient
.CursorType = ADODB.CursorTypeEnum.adOpenStatic
.LockType = ADODB.LockTypeEnum.adLockBatchOptimistic
.Open(insql, cn.ConnectionString)
End With
ElseIf sql_type = 2 Then
Dim cmd As New ADODB.Command
cmd.CommandText = insql.ToString
cmd.ActiveConnection = cn
cmd.CommandType = ADODB.CommandTypeEnum.adCmdStoredProc
cmd.Execute()
End If
cn.Close()
End Sub
What does this specifically mean and what can I do to prevent this whilst executing the utl_file command successfully?
Through StackOverflow I found this helpful link; Here My driver, however, isn't the issue as all other commands execute without issue.
Appreciate anyone who can help.