Re: BLOBs - Mailing list pgsql-sql

From Eugene Yin
Subject Re: BLOBs
Date
Msg-id 1119695599.3064803.1452472672882.JavaMail.yahoo@mail.yahoo.com
Whole thread Raw
In response to Re: BLOBs  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BLOBs
List pgsql-sql
<div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida
Grande,sans-serif;font-size:13px"><div dir="ltr" id="yui_3_16_0_1_1452227859253_128440"><span
id="yui_3_16_0_1_1452227859253_128623"style="line-height: 16.8999996185303px; white-space: pre-wrap; background-color:
rgb(238,238, 238);"><font color="#222426" face="Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans
Mono,Bitstream Vera Sans Mono, Courier New, monospace, sans-serif" id="yui_3_16_0_1_1452227859253_128622">I use the
BLOBin an Oracle table to store IMG and document files. Now for Postgres(9.4.5), I have two options, i.e., BYTEA or
OID.</font></span></div><divdir="ltr" id="yui_3_16_0_1_1452227859253_128440"><span style="line-height:
16.8999996185303px;white-space: pre-wrap; background-color: rgb(238, 238, 238);"><font color="#222426" face="Consolas,
Menlo,Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace,
sans-serif"><br/></font></span></div><div class="" dir="ltr" id="yui_3_16_0_1_1452227859253_128440"><span class=""
id="yui_3_16_0_1_1452227859253_128984"style="color: rgb(34, 36, 38); font-family: Consolas, Menlo, Monaco, 'Lucida
Console','Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;
line-height:16.8999996185303px; white-space: pre-wrap; background-color: rgb(238, 238, 238);">With consideration of
passingthe params </span><span class="" id="yui_3_16_0_1_1452227859253_128993" style="color: rgb(34, 36, 38);
font-family:Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans
Mono','Courier New', monospace, sans-serif; line-height: 16.8999996185303px; white-space: pre-wrap; background-color:
rgb(238,238, 238);">(SAVING) </span><span class="" id="yui_3_16_0_1_1452227859253_128995" style="color: rgb(34, 36,
38);font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans
Mono','Courier New', monospace, sans-serif; line-height: 16.8999996185303px; white-space: pre-wrap; background-color:
rgb(238,238, 238);">from the Java side as follows:</span></div><div class="" dir="ltr"
id="yui_3_16_0_1_1452227859253_128440"><spanclass="" id="yui_3_16_0_1_1452227859253_129306" style="color: rgb(34, 36,
38);font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans
Mono','Courier New', monospace, sans-serif; line-height: 16.8999996185303px; white-space: pre-wrap; background-color:
rgb(238,238, 238);"><br class="" id="yui_3_16_0_1_1452227859253_129308" /></span></div><div class="" dir="ltr"
id="yui_3_16_0_1_1452227859253_128440"><spanclass="" id="yui_3_16_0_1_1452227859253_129034" style="background-color:
rgb(238,238, 238);"><font class="" color="#222426" face="Consolas, Menlo, Monaco, Lucida Console, Liberation Mono,
DejaVuSans Mono, Bitstream Vera Sans Mono, Courier New, monospace, sans-serif"
id="yui_3_16_0_1_1452227859253_128988"><spanclass="" id="yui_3_16_0_1_1452227859253_128990" style="line-height:
16.8999996185303px;white-space: pre-wrap;">DiskFileItemDeepy file = myFile; InputStream is = null; long fileSize = 0;
if(file != null && file.getFileSize() > 0){      is = file.getInputStream();     fileSize =
file.getFileSize();    call.setBinaryStream(1, (InputStream)is, (long)fileSize);</span></font><br class=""
id="yui_3_16_0_1_1452227859253_129314"/></span></div><div class="" dir="ltr"
id="yui_3_16_0_1_1452227859253_128440"><spanclass="" id="yui_3_16_0_1_1452227859253_129317" style="color: rgb(34, 36,
38);font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans
Mono','Courier New', monospace, sans-serif; line-height: 16.8999996185303px; white-space: pre-wrap; background-color:
rgb(238,238, 238);">}</span></div><div class="" dir="ltr" id="yui_3_16_0_1_1452227859253_128440"><span class=""
id="yui_3_16_0_1_1452227859253_129320"style="color: rgb(34, 36, 38); font-family: Consolas, Menlo, Monaco, 'Lucida
Console','Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;
line-height:16.8999996185303px; white-space: pre-wrap; background-color: rgb(238, 238, 238);">...</span></div><div
class=""dir="ltr" id="yui_3_16_0_1_1452227859253_128440"><span class="" id="yui_3_16_0_1_1452227859253_129213"
style="background-color:rgb(238, 238, 238);"><font class="" color="#222426" face="Consolas, Menlo, Monaco, Lucida
Console,Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, sans-serif"
id="yui_3_16_0_1_1452227859253_129180"><spanclass="" id="yui_3_16_0_1_1452227859253_129182" style="line-height:
16.8999996185303px;white-space: pre-wrap;">call.execute(); </span></font></span></div><div class="" dir="ltr"
id="yui_3_16_0_1_1452227859253_128440"><spanclass="" style="background-color: rgb(238, 238, 238);"><font class=""
color="#222426"face="Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans
Mono,Courier New, monospace, sans-serif"><span class="" style="line-height: 16.8999996185303px; white-space:
pre-wrap;"><br/></span></font></span></div><div class="" dir="ltr" id="yui_3_16_0_1_1452227859253_128440"><span
class=""style="background-color: rgb(238, 238, 238);"><font class="" color="#222426" face="Consolas, Menlo, Monaco,
LucidaConsole, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, sans-serif"><span
class=""style="line-height: 16.8999996185303px; white-space: pre-wrap;"><br /></span></font></span></div><div class=""
dir="ltr"id="yui_3_16_0_1_1452227859253_128440"><span class="" id="yui_3_16_0_1_1452227859253_129443"
style="background-color:rgb(238, 238, 238);"><font class="" color="#222426" face="Consolas, Menlo, Monaco, Lucida
Console,Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, sans-serif"
id="yui_3_16_0_1_1452227859253_129442"><spanclass="" id="yui_3_16_0_1_1452227859253_129441" style="line-height:
16.8999996185303px;white-space: pre-wrap;">//When retrieve the data use:</span></font></span></div><div class=""
dir="ltr"id="yui_3_16_0_1_1452227859253_128440"><span class="" style="background-color: rgb(238, 238, 238);"><font
class=""color="#222426" face="Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream
VeraSans Mono, Courier New, monospace, sans-serif"><span class="" style="line-height: 16.8999996185303px; white-space:
pre-wrap;"><br/></span></font></span></div><div class="" dir="ltr" id="yui_3_16_0_1_1452227859253_128440"><span
class=""id="yui_3_16_0_1_1452227859253_129446" style="background-color: rgb(238, 238, 238);"><font class=""
color="#222426"face="Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans
Mono,Courier New, monospace, sans-serif" id="yui_3_16_0_1_1452227859253_129445"><span class=""
id="yui_3_16_0_1_1452227859253_129444"style="line-height: 16.8999996185303px; white-space: pre-wrap;"> java.sql.Blob
blob= (Blob) <span class="" id="yui_3_16_0_1_1452227859253_129515" style="line-height:
16.8999996185303px;">resultSet</span>.getBlob(tableColumnName); </span></font></span></div><div class="" dir="ltr"
id="yui_3_16_0_1_1452227859253_128440"><spanclass="" style="background-color: rgb(238, 238, 238);"><font class=""
color="#222426"face="Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans
Mono,Courier New, monospace, sans-serif"><span class="" style="line-height: 16.8999996185303px; white-space:
pre-wrap;"><br/></span></font></span></div><div class="" dir="ltr" id="yui_3_16_0_1_1452227859253_128440"><span
class=""style="background-color: rgb(238, 238, 238);"><font class="" color="#222426" face="Consolas, Menlo, Monaco,
LucidaConsole, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, sans-serif"><span
class=""style="line-height: 16.8999996185303px; white-space: pre-wrap;"><br /></span></font></span></div><div dir="ltr"
id="yui_3_16_0_1_1452227859253_128440"><spanid="yui_3_16_0_1_1452227859253_128718" style="line-height:
16.8999996185303px;white-space: pre-wrap; background-color: rgb(238, 238, 238);"><font color="#222426" face="Consolas,
Menlo,Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace,
sans-serif"id="yui_3_16_0_1_1452227859253_128719">For the purpose mentioned above, which Postgres data type is a better
candidatefor replacement the BLOB, </font></span><span class="" id="yui_3_16_0_1_1452227859253_128717" style="color:
rgb(34,36, 38); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono',
'BitstreamVera Sans Mono', 'Courier New', monospace, sans-serif; line-height: 16.8999996185303px; white-space:
pre-wrap;background-color: rgb(238, 238, 238);">BYTEA or OID?</span></div><div dir="ltr"
id="yui_3_16_0_1_1452227859253_128440"><spanclass="" style="color: rgb(34, 36, 38); font-family: Consolas, Menlo,
Monaco,'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace,
sans-serif;line-height: 16.8999996185303px; white-space: pre-wrap; background-color: rgb(238, 238, 238);"><br
/></span></div><divdir="ltr" id="yui_3_16_0_1_1452227859253_128440"><br /></div><div dir="ltr"
id="yui_3_16_0_1_1452227859253_128440"><spanclass="" style="color: rgb(34, 36, 38); font-family: Consolas, Menlo,
Monaco,'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace,
sans-serif;line-height: 16.8999996185303px; white-space: pre-wrap; background-color: rgb(238, 238, 238);"><br
/></span></div><divdir="ltr" id="yui_3_16_0_1_1452227859253_128440"><span class=""
id="yui_3_16_0_1_1452227859253_128919"style="color: rgb(34, 36, 38); font-family: Consolas, Menlo, Monaco, 'Lucida
Console','Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif;
line-height:16.8999996185303px; white-space: pre-wrap; background-color: rgb(238, 238, 238);">Thanks</span></div><div
dir="ltr"id="yui_3_16_0_1_1452227859253_128440"><span class="" style="color: rgb(34, 36, 38); font-family: Consolas,
Menlo,Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New',
monospace,sans-serif; line-height: 16.8999996185303px; white-space: pre-wrap; background-color: rgb(238, 238,
238);"><br/></span></div><div dir="ltr" id="yui_3_16_0_1_1452227859253_128440"><span class="" style="color: rgb(34, 36,
38);font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans
Mono','Courier New', monospace, sans-serif; line-height: 16.8999996185303px; white-space: pre-wrap; background-color:
rgb(238,238, 238);">Eugene</span></div><div dir="ltr" id="yui_3_16_0_1_1452227859253_128440"><br /></div><div
class="qtdSeparateBR"><br/><br /></div><div class="yahoo_quoted" style="display: block;"><div style="font-family:
HelveticaNeue,Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 13px;"><div style="font-family:
HelveticaNeue,Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;"><div dir="ltr"><font
face="Arial"size="2"> On Saturday, January 9, 2016 11:13 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:<br
/></font></div><br/><br /><div class="y_msg_container">Eugene Yin <<a class="removed-link" href="" shape="rect"
ymailto="mailto:eugeneymail@ymail.com">eugeneymail@ymail.com</a>>writes:<div class="yqt5061021327"
id="yqtfd57926"><brclear="none" />> The following statement is excerpted from the <br clear="none" />> "Oracle to
PostgresConversion"<br clear="none" />> <a class="removed-link" href="" shape="rect"
target="_blank">https://wiki.postgresql.org/wiki/Oracle_to_Postgres_Conversion#Grammar_Differences</a></div><br
clear="none"/><br clear="none" />My goodness, that's out of date (as you should have guessed from the<br clear="none"
/>referenceto "scheduled for an overhaul in summer 2000").  pg_dump<br clear="none" />has been able to dump large
objectsjust fine since 8.1 or so.<br clear="none" /><br clear="none" />I don't know what else an Oracle user might be
expectingthat we don't<br clear="none" />have, though, so I'm hesitant to change the text.<br clear="none" /><br
clear="none"/>            regards, tom lane<br clear="none" /><br clear="none" /><br clear="none" />-- <br clear="none"
/>Sentvia pgsql-sql mailing list (<a class="removed-link" href="" shape="rect"
ymailto="mailto:pgsql-sql@postgresql.org">pgsql-sql@postgresql.org</a>)<brclear="none" />To make changes to your
subscription:<brclear="none" /><a class="removed-link" href="" shape="rect"
target="_blank">http://www.postgresql.org/mailpref/pgsql-sql</a><divclass="yqt5061021327" id="yqtfd99998"><br
clear="none"/></div><br /><br /></div></div></div></div></div> 

pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: BLOBs
Next
From: Andreas Joseph Krogh
Date:
Subject: Re: BLOBs