blobÀº ¾î¶»°Ô insertÇÒ±î¿ä?


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :Á¶¹Î¼ö 2000³â 1¿ù 31ÀÏ 13:28:23

In Reply to: oracle8i¿¡¼­ blob() ¿¡ ´ëÇؼ­ ..... posted by ¹é½ÂÁø on 2000³â 1¿ù 29ÀÏ 22:20:24:

¸ÕÀú tableÀÌ ´ÙÀ½°ú °°´Ù°í ÇսôÙ.
SQL>desc testtable
Name Type
----------------------
ID number
myblob blob


1. insert into testtable values (1, empty_blob());
//empty_blob()ÀÌ ²À ÇÊ¿ä..
2. ¾Æ·¡¿Í ºñ½ÁÇÏ°Ô ÇÏ½Ã¸é µË´Ï´Ù. ¹°·Ð 8iÀÇ blob°ü·Ã package¸¦ ÀÌ¿ëÇÒ ¼öµµ ÀÖ½À´Ï´Ù. ³»¿ë ¾²´Â ¶õÀÌ Á¼¾Æ¼­ ÀÚ¼¼È÷´Â ¸ø¾²°Ú³×¿ä...


statement = conn.createStatement(); resultSet = statement.executeQuery( " select * from testtable");
if (resultSet.next()) {
oracle.sql.BLOB blob = ((OracleResultSet)resultSet).getBLOB(1);
}
OutputStream outstream = blob.getBinaryOutputStream();
ByteArrayInputStream ba = new ByteArrayInputStream(fileContent);
int chunk = blob.getChunkSize();


byte[] buffer = new byte[chunk];
//byte[] buffer = new byte[1024*16];
int length = -1;


while (( length = ba.read(buffer)) != -1) {


outstream.write(buffer,0,length);
//outstream.flush();
}
outstream.close();
ba.close();


.....



´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
HTML ÅÂ±× Æ÷ÇÔ ¿©ºÎ: HTML ¹®¼­ÀÏ °æ¿ì üũ
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]