开发者

How do you insert 9 MB file into a Blob Field Using Oracle.DataAccess?

开发者 https://www.devze.com 2022-12-30 03:06 出处:网络
Trying to insert a large audio file into an Oracle 10g database and keep getting this error: ORA-01460: unimplemented or unreasonable conversion requested

Trying to insert a large audio file into an Oracle 10g database and keep getting this error:

ORA-01460: unimplemented or unreasonable conversion requested

The byte array length of the audio file is 2702577. The procedure works with smaller array lengths, but not the larger ones.

Here is my code and Thanks!

Dim oracleConnection As New OracleClient.OracleConnection
        Dim Cmd As New OracleClient.OracleCommand
        Dim oracleDataAdapter As New OracleDataAdapter

        oracleConnection.ConnectionString = System.Configuration.ConfigurationManager.AppSettings("MasterConnectionODT")
        Cmd.Connection = oracleConnection
        Cmd.CommandText = "Audio.ADD_AUDIO"
        Cmd.CommandType = CommandType.Stored开发者_运维问答Procedure

        Dim aParam As New OracleClient.OracleParameter
        aParam.ParameterName = "I_FACILITY_ID_C"
        aParam.OracleType = OracleType.Char
        aParam.Value = FacID
        aParam.Direction = ParameterDirection.Input
        Cmd.Parameters.Add(aParam)

        aParam = New OracleParameter
        aParam.ParameterName = "I_TARP_ID_N"
        aParam.OracleType = OracleType.Number
        aParam.Value = TarpID
        aParam.Direction = ParameterDirection.Input
        Cmd.Parameters.Add(aParam)

        aParam = New OracleParameter
        aParam.ParameterName = "I_AUDIO_BLOB"
        aParam.OracleType = OracleType.Blob
        aParam.Value = Audio
        aParam.Direction = ParameterDirection.Input
        Cmd.Parameters.Add(aParam)


        Using oracleConnection
            oracleConnection.Open()
            Cmd.ExecuteNonQuery()
        End Using


You can't pass parameters larger than 32k into a stored procedure. Change your command to SQL instead. So it would be something like:

Cmd.CommandText = "insert into yourtable values (:I_FACILITY_ID_C, :I_TARP_ID_N, :I_AUDIO_BLOB)"
Cmd.CommandType = CommandType.Text

If you still have trouble, you try using ODP.Net if you aren't already.

0

精彩评论

暂无评论...
验证码 换一张
取 消