0

We have our own DataAccess library built upon the Microsoft Enterprise Data Access block.

I have stored procedure that takes binary file content as input parameter and store it into DB.

byte[] imageFileByteArray = this.GetByteArrayFromFile(imageFile);
this.dataAccess.AddCmdParameter("DOCIMAGE", System.Data.DbType.Binary, imageFileByteArray);

This code is working fine when using SQL database, But when I switched to Oracle, I get the exception saying that "Wrong type of parameter"

In oracle db, the DOCIMAGE column is declared as BLOB field.

Why inferred Dbtype.Binary is not working for oracle?

2 Answers 2

1

You will need to use an OracleParameter, with the OracleType enum value Blob, see here for more...

http://msdn.microsoft.com/en-us/library/system.data.oracleclient.oracletype.aspx

Sign up to request clarification or add additional context in comments.

1 Comment

As i have mentioned, we are using our own DAL dll which doesn't accept explicit OracleType other than DbType.
0

This is probably to do with different Oracle inference of OracleDbType from System.Data.DbType. The System.Data.DbType.Binary has coresponding OracleDbType=Raw. You would have to use System.Data.DbType.Object to get OracleDbType=Blob, for more details see Table 3-3 in http://docs.oracle.com/html/B14164_01/featOraCommand.htm

1 Comment

I tried, and I get this following error."Cannot bind type System.Byte[] as Blob." But in this post says, he got it working after changing it from DbType.Object to DbType.Binary. Either way it is not working for me. Any suggestions?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.