how to Store image in Oracledatabase in Binary foramat

Hi Forum Member,

i want to save my image file(.jpg,jpeg,png,etc...) in oracle DataBase in binary format and when i extract that file which store in database(Binary format) it will extract to my page with image format.

which will be show in my page

So how i will do help me if any body have some example so give to me

thanking you

Subhakanta

0
Subhakanta
4/21/2009 9:20:08 AM
asp.net.oracle 2269 articles. 0 followers. Follow

6 Replies
579 Views

Similar Articles

[PageSpeed] 0

You can do this using BLOB fielftype in Oracle DB, you find examples in following links.

http://www.codeproject.com/KB/database/Blobfield.aspx

http://www.c-sharpcorner.com/UploadFile/ehanth/Csharpdatabse03142006093738AM/Csharpdatabse.aspx?ArticleID=c3fef0d2-f165-4384-a788-cdb860922d8a


MARK AS ANSWER IF MY POST HELPED YOU!
THIS REDUCES TIME FOR OTHERS..!
0
SurendraKishore
4/21/2009 11:52:02 AM

YOU CAN TRY WITH LINK:
http://www.codeproject.com/KB/database/Blobfield.aspx

HOPE IT WILL HELP YOU.
MARK AS ANSWER if its help you.


Shawpnendu Bikash Maloroy
http://shawpnendu.blogspot.com
0
shawpnendu
4/21/2009 12:36:24 PM

Here is an example
create table av_data
(blob_id number(10,0) not null
,description varchar2(25) not null
,blob_data long raw null);

Further you can make use of a stored proc, that will read the picture file in the DB server, like the following example

DECLARE
v_dirname varchar2(255);
v_filename varchar2(255);

BEGIN
v_dirname := 'C:\';

v_filename := get_file_name(v_dirname,NULL,'Bitmap file(*.bmp)|*.bmp|'| |
'JPEG files (*.jpg)|*.jpg|');

IF v_filename is not null THEN
read_file_image(v_filename,'ANY','block_name.blob_data');
END IF;
END;

Here is one more example

http://www.codeproject.com/KB/database/Blobfield.aspx


Many Thanks & Best Regards,
HuaMin Chen

(Mark it as answer if it does help you!)
0
wmec
4/22/2009 2:17:22 AM

Hi,

someone help me please!

Thanking you

 

0
Subhakanta
4/22/2009 1:07:06 PM

Hi,

try this

someone help me please!

Sub SAVEDATA()
        Try
            con.Open()
              Dim fileUpload1 As FileUpload = CType(Me.FindControl("FileUpload1"), FileUpload)
            'Make sure a file has been successfully uploaded
            If fileUpload1.PostedFile Is Nothing OrElse String.IsNullOrEmpty(fileUpload1.PostedFile.FileName) OrElse fileUpload1.PostedFile.InputStream Is Nothing Then
                Label1.Text = "Please Upload Valid picture file"
                Exit Sub
            End If
            'Make sure we are dealing with a JPG or GIF file
            Dim extension As String = System.IO.Path.GetExtension(fileUpload1.PostedFile.FileName).ToLower()
            Dim MIMEType As String = Nothing
            Select Case extension
                Case ".gif"
                    MIMEType = "image/gif"
                Case ".jpg", ".jpeg", ".jpe"
                    MIMEType = "image/jpeg"
                Case ".png"
                    MIMEType = "image/png"
                Case Else
                    'Invalid file type uploaded
                    Label1.Text = "Not a Valid file format"
                    Exit Sub
            End Select
            'Connect to the database and insert a new record into Products
            _strQuery = "INSERT INTO..."
            com = New OracleCommand()
           
            'Load FileUpload's InputStream into Byte array
            Dim imageBytes(fileUpload1.PostedFile.InputStream.Length) As Byte
            fileUpload1.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length)
            com.Parameters.AddWithValue(":DVMIMG", imageBytes)

            com.Connection = con
           
            com.CommandText = _strQuery
            com.ExecuteNonQuery()
           
            con.Close()

        Catch ex As Exception
          
    End Sub

 

 

0
salman
4/22/2009 1:15:27 PM

Hi salman behera.

Thank you very much.you example is perfect.it working fine.

Thanking you.

0
Subhakanta
4/23/2009 5:54:26 AM
Reply:

Web resources about - how to Store image in Oracledatabase in Binary foramat - asp.net.oracle

Search Twitter - oow11
Sign in Sign up Search Refresh Howard Beader @ hbeader 25 Sep Oracle Expands In The Cloud With 10 New Services onforb.es/182x8uL #oow11 #oraclemiddle ...

Protecting Oracle Database 12c
... cloud feature set. ProtectingOracle Database 12c helps you solvethe problem of maximizing the safety, resilience, and security of an Oracledatabase ...

Oracle, Sun Show Off Super-Fast, Flash-Based OLTP Server
Dubbed the Exadata Database Machine Version 2, the new server package is a Sun server-and-storage combination loaded with lots of flash memory ...

Amazon offers faster, more flexible database IOPs
... to start again. Later on, users will be able to move existing legacy RDS instances to provisioned IOPS storage — at least for MySQL and Oracledatabases. ...

Oracle Reports Q3 GAAP EPS Up 75% to 41 Cents; Non-GAAP EPS Up 40% to 54 Cents
REDWOOD SHORES, CA(Marketwire - March 24, 2011) - Oracle Corporation (NASDAQ: ORCL) today announced fiscal 2011 Q3 GAAP total revenues were up ...

The Oracle Software Security Assurance Blog
Blogs.Oracle.Com - The Oracle Software Security Assurance Blog

Oracle Blogs - Homepage
Blogs.Oracle.Com DearPartners, We would like to extend our sincere thanks to thoseof you who attended our TechCast on " OracleDatabase Appliance ...

DanielRoth.net
Recent business, technology and trend stories by Daniel Roth, a senior writer at WIRED magazine.

Choose an integrated stack for efficiency, easy storage implementation
An integrated stack bundles storage, servers and networking in a single preconfigured product. They require minimal integration to get up and ...

Oracle (@Oracle) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Resources last updated: 12/18/2015 1:34:38 PM