Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 29th, 2003, 04:47 AM
elvischuah elvischuah is offline
elvis
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 28 elvischuah User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
how to insert bitmap into Oracle8i using java

hi all,
Is there anyone know how to insert a bitmap file size 596KB into oracle8i using Java via preapred statement?
I created a table with two BLOB columns and some other VARCHAR2 columns. But uncertain on how to insert bitmap in oracle via preparedStatement.
I used to insert the bitmap into PGSQL, bytea data type. How to do it in oracle8i?
BFILE is not advisable in my application. Because it required operating system i/o.

pls helps...
regards
elvis

Reply With Quote
  #2  
Old December 29th, 2003, 08:47 AM
Dan Drillich Dan Drillich is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 68 Dan Drillich User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Here is a proc of mine in which I use the PreparedStatement class:

private static void insertDB (String category, String subCategory, String action, String count,String percentage, String name, String timeZone, int begin, int end) throws java.sql.SQLException
{

String d = quotedString(extractDateFromFilename(inputFileName));

String s = "insert into Voice_Metrics values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, to_date(" + d + ",'YYYYMMDD'), sysdate)";

PreparedStatement pstmt = conn.prepareStatement(s);


pstmt.setString(1,category);
pstmt.setString(2,subCategory);
pstmt.setString(3,action);
pstmt.setString(4,count);
pstmt.setString(5,percentage);
pstmt.setString(6,name);
pstmt.setString(7,timeZone);
pstmt.setInt(8,begin);
pstmt.setInt(9,end);
pstmt.setString(10,inputFile);

int r = pstmt.executeUpdate();

}



About the blob data type - I just tried:

create table myTable (
bb blob
);

insert into myTable (bb) values ('ff00123213ff00ffaa');

It seems that Oracle expects the blob value to be encoded as hex string, because when I tried:

insert into myTable (bb) values ('Q');

I got: ORA-01465: invalid hex number

Regards,
Dan

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > how to insert bitmap into Oracle8i using java


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT