Thread: types used for JDBC BLOB and CLOB?
Just been asked this, and I'm not sure of the answer ... based on reading the docs on bytea, I'm assuming that it is such, but can someone please confirm? Thanks ... ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664
Marc, If you are specifically talking about the JDBC types BLOB and CLOB those classes use the server LargeObject interface. If you are speaking generically about support for large objects then the jdbc driver supports the bytea datatype for the get/setBinaryStream() methods. So the answer is "it depends", on how you use the driver. The specifics for supporting binary objects are documented in a section on this topic in the postgresql jdbc driver documentation chapter. Thanks, --Barry -----Original Message----- From: Marc G. Fournier [mailto:scrappy@postgresql.org] Sent: Monday, August 23, 2004 8:44 AM To: pgsql-jdbc@postgresql.org Subject: [JDBC] types used for JDBC BLOB and CLOB? Just been asked this, and I'm not sure of the answer ... based on reading the docs on bytea, I'm assuming that it is such, but can someone please confirm? Thanks ... ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664 ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
'k, I believe what the client is wanting to know is what the storage type would be on the backend, that the would BLOB/CLOB map to ... bytea? On Mon, 23 Aug 2004, Barry Lind wrote: > Marc, > > If you are specifically talking about the JDBC types BLOB and CLOB those > classes use the server LargeObject interface. If you are speaking > generically about support for large objects then the jdbc driver > supports the bytea datatype for the get/setBinaryStream() methods. So > the answer is "it depends", on how you use the driver. The specifics > for supporting binary objects are documented in a section on this topic > in the postgresql jdbc driver documentation chapter. > > Thanks, > --Barry > > -----Original Message----- > From: Marc G. Fournier [mailto:scrappy@postgresql.org] > Sent: Monday, August 23, 2004 8:44 AM > To: pgsql-jdbc@postgresql.org > Subject: [JDBC] types used for JDBC BLOB and CLOB? > > > Just been asked this, and I'm not sure of the answer ... based on > reading the docs on bytea, I'm assuming that it is such, but can someone > please confirm? > > Thanks ... > > ---- > Marc G. Fournier Hub.Org Networking Services > (http://www.hub.org) > Email: scrappy@hub.org Yahoo!: yscrappy ICQ: > 7615664 > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > > ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664
Marc, The answer is it depends, but if they intend to use the jdbc BLOB/CLOB interface it is server side LargeObjects, not bytea. However you can use bytea, but then you need to use the get/setXXXStream() interfaces. Thanks, --Barry -----Original Message----- From: Marc G. Fournier [mailto:scrappy@postgresql.org] Sent: Monday, August 23, 2004 11:52 AM To: Barry Lind Cc: Marc G. Fournier; pgsql-jdbc@postgresql.org Subject: RE: [JDBC] types used for JDBC BLOB and CLOB? 'k, I believe what the client is wanting to know is what the storage type would be on the backend, that the would BLOB/CLOB map to ... bytea? On Mon, 23 Aug 2004, Barry Lind wrote: > Marc, > > If you are specifically talking about the JDBC types BLOB and CLOB > those classes use the server LargeObject interface. If you are > speaking generically about support for large objects then the jdbc > driver supports the bytea datatype for the get/setBinaryStream() > methods. So the answer is "it depends", on how you use the driver. > The specifics for supporting binary objects are documented in a > section on this topic in the postgresql jdbc driver documentation chapter. > > Thanks, > --Barry > > -----Original Message----- > From: Marc G. Fournier [mailto:scrappy@postgresql.org] > Sent: Monday, August 23, 2004 8:44 AM > To: pgsql-jdbc@postgresql.org > Subject: [JDBC] types used for JDBC BLOB and CLOB? > > > Just been asked this, and I'm not sure of the answer ... based on > reading the docs on bytea, I'm assuming that it is such, but can > someone please confirm? > > Thanks ... > > ---- > Marc G. Fournier Hub.Org Networking Services > (http://www.hub.org) > Email: scrappy@hub.org Yahoo!: yscrappy ICQ: > 7615664 > > ---------------------------(end of > broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > > ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664
k .. I'm obviously missing something, and having never used BLOBs before, I'm not surprised ... Looking at: http://www.postgresql.org/docs/7.4/static/lo-implementation.html It states: "The large object implementation breaks large objects up into "chunks" and stores the chunks in rows in the database." When I create my schema for this, what type do I assign the field? Or is there a special 'table' created when you do the lo_creat to store the BLOBs in? (looking at docs, which references the libpq library vs JDBC, sorry) For instance, I notice in: http://www.postgresql.org/docs/7.4/static/lo-interfaces.html "Oid lo_creat(PGconn *conn, int mode);" So, lo_creat returns an OID ... is that what I'd store in a table, and when I needed the value, would call lo_open to actually access it as I need? The part that is confusing me is the point about 'chunks' above ... from that, it seems that the data is stored in table within the database ... but if so, what type does one define to store it in? how would a 'pg_dump' show the schema? Hopefully this explains a bit better my confusion here :( On Mon, 23 Aug 2004, Barry Lind wrote: > Marc, > > The answer is it depends, but if they intend to use the jdbc BLOB/CLOB > interface it is server side LargeObjects, not bytea. However you can > use bytea, but then you need to use the get/setXXXStream() interfaces. > > Thanks, > --Barry > > -----Original Message----- > From: Marc G. Fournier [mailto:scrappy@postgresql.org] > Sent: Monday, August 23, 2004 11:52 AM > To: Barry Lind > Cc: Marc G. Fournier; pgsql-jdbc@postgresql.org > Subject: RE: [JDBC] types used for JDBC BLOB and CLOB? > > > 'k, I believe what the client is wanting to know is what the storage > type would be on the backend, that the would BLOB/CLOB map to ... bytea? > > On Mon, 23 Aug 2004, Barry Lind wrote: > >> Marc, >> >> If you are specifically talking about the JDBC types BLOB and CLOB >> those classes use the server LargeObject interface. If you are >> speaking generically about support for large objects then the jdbc >> driver supports the bytea datatype for the get/setBinaryStream() >> methods. So the answer is "it depends", on how you use the driver. >> The specifics for supporting binary objects are documented in a >> section on this topic in the postgresql jdbc driver documentation > chapter. >> >> Thanks, >> --Barry >> >> -----Original Message----- >> From: Marc G. Fournier [mailto:scrappy@postgresql.org] >> Sent: Monday, August 23, 2004 8:44 AM >> To: pgsql-jdbc@postgresql.org >> Subject: [JDBC] types used for JDBC BLOB and CLOB? >> >> >> Just been asked this, and I'm not sure of the answer ... based on >> reading the docs on bytea, I'm assuming that it is such, but can >> someone please confirm? >> >> Thanks ... >> >> ---- >> Marc G. Fournier Hub.Org Networking Services >> (http://www.hub.org) >> Email: scrappy@hub.org Yahoo!: yscrappy ICQ: >> 7615664 >> >> ---------------------------(end of >> broadcast)--------------------------- >> TIP 7: don't forget to increase your free space map settings >> >> > > ---- > Marc G. Fournier Hub.Org Networking Services > (http://www.hub.org) > Email: scrappy@hub.org Yahoo!: yscrappy ICQ: > 7615664 > > ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664
If you want to use the BLOB JDBC calls, you will use the OID type for the field in your table schema. You do NOT need to use the lo_ routines since they will be called for you if you use the JDBC BLOB calls. David ----- Original Message ----- From: "Marc G. Fournier" <scrappy@postgresql.org> To: "Barry Lind" <blind@xythos.com> Cc: "Marc G. Fournier" <scrappy@postgresql.org>; <pgsql-jdbc@postgresql.org> Sent: Monday, August 23, 2004 3:06 PM Subject: Re: [JDBC] types used for JDBC BLOB and CLOB? > > k .. I'm obviously missing something, and having never used BLOBs before, > I'm not surprised ... > > Looking at: > > http://www.postgresql.org/docs/7.4/static/lo-implementation.html > > It states: > > "The large object implementation breaks large objects up into "chunks" and > stores the chunks in rows in the database." > > When I create my schema for this, what type do I assign the field? Or is > there a special 'table' created when you do the lo_creat to store the > BLOBs in? (looking at docs, which references the libpq library vs JDBC, > sorry) > > For instance, I notice in: > > http://www.postgresql.org/docs/7.4/static/lo-interfaces.html > > "Oid lo_creat(PGconn *conn, int mode);" > > So, lo_creat returns an OID ... is that what I'd store in a table, and > when I needed the value, would call lo_open to actually access it as I > need? > > The part that is confusing me is the point about 'chunks' above ... from > that, it seems that the data is stored in table within the database ... > but if so, what type does one define to store it in? how would a > 'pg_dump' show the schema? > > Hopefully this explains a bit better my confusion here :( > > > On Mon, 23 Aug 2004, Barry Lind wrote: > > > Marc, > > > > The answer is it depends, but if they intend to use the jdbc BLOB/CLOB > > interface it is server side LargeObjects, not bytea. However you can > > use bytea, but then you need to use the get/setXXXStream() interfaces. > > > > Thanks, > > --Barry > > > > -----Original Message----- > > From: Marc G. Fournier [mailto:scrappy@postgresql.org] > > Sent: Monday, August 23, 2004 11:52 AM > > To: Barry Lind > > Cc: Marc G. Fournier; pgsql-jdbc@postgresql.org > > Subject: RE: [JDBC] types used for JDBC BLOB and CLOB? > > > > > > 'k, I believe what the client is wanting to know is what the storage > > type would be on the backend, that the would BLOB/CLOB map to ... bytea? > > > > On Mon, 23 Aug 2004, Barry Lind wrote: > > > >> Marc, > >> > >> If you are specifically talking about the JDBC types BLOB and CLOB > >> those classes use the server LargeObject interface. If you are > >> speaking generically about support for large objects then the jdbc > >> driver supports the bytea datatype for the get/setBinaryStream() > >> methods. So the answer is "it depends", on how you use the driver. > >> The specifics for supporting binary objects are documented in a > >> section on this topic in the postgresql jdbc driver documentation > > chapter. > >> > >> Thanks, > >> --Barry > >> > >> -----Original Message----- > >> From: Marc G. Fournier [mailto:scrappy@postgresql.org] > >> Sent: Monday, August 23, 2004 8:44 AM > >> To: pgsql-jdbc@postgresql.org > >> Subject: [JDBC] types used for JDBC BLOB and CLOB? > >> > >> > >> Just been asked this, and I'm not sure of the answer ... based on > >> reading the docs on bytea, I'm assuming that it is such, but can > >> someone please confirm? > >> > >> Thanks ... > >> > >> ---- > >> Marc G. Fournier Hub.Org Networking Services > >> (http://www.hub.org) > >> Email: scrappy@hub.org Yahoo!: yscrappy ICQ: > >> 7615664 > >> > >> ---------------------------(end of > >> broadcast)--------------------------- > >> TIP 7: don't forget to increase your free space map settings > >> > >> > > > > ---- > > Marc G. Fournier Hub.Org Networking Services > > (http://www.hub.org) > > Email: scrappy@hub.org Yahoo!: yscrappy ICQ: > > 7615664 > > > > > > ---- > Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) > Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664 > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster
Perfect, thank you ... re: the lo_ calls ... ya, I figured that, but I needed something to act as a reference for this ;) Thanks ... On Mon, 23 Aug 2004, David Wall wrote: > If you want to use the BLOB JDBC calls, you will use the OID type for the > field in your table schema. > > You do NOT need to use the lo_ routines since they will be called for you if > you use the JDBC BLOB calls. > > David > > ----- Original Message ----- > From: "Marc G. Fournier" <scrappy@postgresql.org> > To: "Barry Lind" <blind@xythos.com> > Cc: "Marc G. Fournier" <scrappy@postgresql.org>; <pgsql-jdbc@postgresql.org> > Sent: Monday, August 23, 2004 3:06 PM > Subject: Re: [JDBC] types used for JDBC BLOB and CLOB? > > >> >> k .. I'm obviously missing something, and having never used BLOBs before, >> I'm not surprised ... >> >> Looking at: >> >> http://www.postgresql.org/docs/7.4/static/lo-implementation.html >> >> It states: >> >> "The large object implementation breaks large objects up into "chunks" and >> stores the chunks in rows in the database." >> >> When I create my schema for this, what type do I assign the field? Or is >> there a special 'table' created when you do the lo_creat to store the >> BLOBs in? (looking at docs, which references the libpq library vs JDBC, >> sorry) >> >> For instance, I notice in: >> >> http://www.postgresql.org/docs/7.4/static/lo-interfaces.html >> >> "Oid lo_creat(PGconn *conn, int mode);" >> >> So, lo_creat returns an OID ... is that what I'd store in a table, and >> when I needed the value, would call lo_open to actually access it as I >> need? >> >> The part that is confusing me is the point about 'chunks' above ... > from >> that, it seems that the data is stored in table within the database ... >> but if so, what type does one define to store it in? how would a >> 'pg_dump' show the schema? >> >> Hopefully this explains a bit better my confusion here :( >> >> >> On Mon, 23 Aug 2004, Barry Lind wrote: >> >>> Marc, >>> >>> The answer is it depends, but if they intend to use the jdbc BLOB/CLOB >>> interface it is server side LargeObjects, not bytea. However you can >>> use bytea, but then you need to use the get/setXXXStream() interfaces. >>> >>> Thanks, >>> --Barry >>> >>> -----Original Message----- >>> From: Marc G. Fournier [mailto:scrappy@postgresql.org] >>> Sent: Monday, August 23, 2004 11:52 AM >>> To: Barry Lind >>> Cc: Marc G. Fournier; pgsql-jdbc@postgresql.org >>> Subject: RE: [JDBC] types used for JDBC BLOB and CLOB? >>> >>> >>> 'k, I believe what the client is wanting to know is what the storage >>> type would be on the backend, that the would BLOB/CLOB map to ... bytea? >>> >>> On Mon, 23 Aug 2004, Barry Lind wrote: >>> >>>> Marc, >>>> >>>> If you are specifically talking about the JDBC types BLOB and CLOB >>>> those classes use the server LargeObject interface. If you are >>>> speaking generically about support for large objects then the jdbc >>>> driver supports the bytea datatype for the get/setBinaryStream() >>>> methods. So the answer is "it depends", on how you use the driver. >>>> The specifics for supporting binary objects are documented in a >>>> section on this topic in the postgresql jdbc driver documentation >>> chapter. >>>> >>>> Thanks, >>>> --Barry >>>> >>>> -----Original Message----- >>>> From: Marc G. Fournier [mailto:scrappy@postgresql.org] >>>> Sent: Monday, August 23, 2004 8:44 AM >>>> To: pgsql-jdbc@postgresql.org >>>> Subject: [JDBC] types used for JDBC BLOB and CLOB? >>>> >>>> >>>> Just been asked this, and I'm not sure of the answer ... based on >>>> reading the docs on bytea, I'm assuming that it is such, but can >>>> someone please confirm? >>>> >>>> Thanks ... >>>> >>>> ---- >>>> Marc G. Fournier Hub.Org Networking Services >>>> (http://www.hub.org) >>>> Email: scrappy@hub.org Yahoo!: yscrappy ICQ: >>>> 7615664 >>>> >>>> ---------------------------(end of >>>> broadcast)--------------------------- >>>> TIP 7: don't forget to increase your free space map settings >>>> >>>> >>> >>> ---- >>> Marc G. Fournier Hub.Org Networking Services >>> (http://www.hub.org) >>> Email: scrappy@hub.org Yahoo!: yscrappy ICQ: >>> 7615664 >>> >>> >> >> ---- >> Marc G. Fournier Hub.Org Networking Services > (http://www.hub.org) >> Email: scrappy@hub.org Yahoo!: yscrappy ICQ: > 7615664 >> >> ---------------------------(end of broadcast)--------------------------- >> TIP 4: Don't 'kill -9' the postmaster > > ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664
Marc, I think the following documentation is what you want to look at: http://www.postgresql.org/docs/7.4/static/jdbc-binary-data.html It goes into some detail on the two different methods of storing binary data, and the pros and cons of each. --Barry -----Original Message----- From: Marc G. Fournier [mailto:scrappy@postgresql.org] Sent: Monday, August 23, 2004 3:07 PM To: Barry Lind Cc: Marc G. Fournier; pgsql-jdbc@postgresql.org Subject: RE: [JDBC] types used for JDBC BLOB and CLOB? k .. I'm obviously missing something, and having never used BLOBs before, I'm not surprised ... Looking at: http://www.postgresql.org/docs/7.4/static/lo-implementation.html It states: "The large object implementation breaks large objects up into "chunks" and stores the chunks in rows in the database." When I create my schema for this, what type do I assign the field? Or is there a special 'table' created when you do the lo_creat to store the BLOBs in? (looking at docs, which references the libpq library vs JDBC, sorry) For instance, I notice in: http://www.postgresql.org/docs/7.4/static/lo-interfaces.html "Oid lo_creat(PGconn *conn, int mode);" So, lo_creat returns an OID ... is that what I'd store in a table, and when I needed the value, would call lo_open to actually access it as I need? The part that is confusing me is the point about 'chunks' above ... from that, it seems that the data is stored in table within the database ... but if so, what type does one define to store it in? how would a 'pg_dump' show the schema? Hopefully this explains a bit better my confusion here :( On Mon, 23 Aug 2004, Barry Lind wrote: > Marc, > > The answer is it depends, but if they intend to use the jdbc BLOB/CLOB > interface it is server side LargeObjects, not bytea. However you can > use bytea, but then you need to use the get/setXXXStream() interfaces. > > Thanks, > --Barry > > -----Original Message----- > From: Marc G. Fournier [mailto:scrappy@postgresql.org] > Sent: Monday, August 23, 2004 11:52 AM > To: Barry Lind > Cc: Marc G. Fournier; pgsql-jdbc@postgresql.org > Subject: RE: [JDBC] types used for JDBC BLOB and CLOB? > > > 'k, I believe what the client is wanting to know is what the storage > type would be on the backend, that the would BLOB/CLOB map to ... bytea? > > On Mon, 23 Aug 2004, Barry Lind wrote: > >> Marc, >> >> If you are specifically talking about the JDBC types BLOB and CLOB >> those classes use the server LargeObject interface. If you are >> speaking generically about support for large objects then the jdbc >> driver supports the bytea datatype for the get/setBinaryStream() >> methods. So the answer is "it depends", on how you use the driver. >> The specifics for supporting binary objects are documented in a >> section on this topic in the postgresql jdbc driver documentation > chapter. >> >> Thanks, >> --Barry >> >> -----Original Message----- >> From: Marc G. Fournier [mailto:scrappy@postgresql.org] >> Sent: Monday, August 23, 2004 8:44 AM >> To: pgsql-jdbc@postgresql.org >> Subject: [JDBC] types used for JDBC BLOB and CLOB? >> >> >> Just been asked this, and I'm not sure of the answer ... based on >> reading the docs on bytea, I'm assuming that it is such, but can >> someone please confirm? >> >> Thanks ... >> >> ---- >> Marc G. Fournier Hub.Org Networking Services >> (http://www.hub.org) >> Email: scrappy@hub.org Yahoo!: yscrappy ICQ: >> 7615664 >> >> ---------------------------(end of >> broadcast)--------------------------- >> TIP 7: don't forget to increase your free space map settings >> >> > > ---- > Marc G. Fournier Hub.Org Networking Services > (http://www.hub.org) > Email: scrappy@hub.org Yahoo!: yscrappy ICQ: > 7615664 > > ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664