pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ODBC, large objects and tracing
3+ messages / 3 participants
[nested] [flat]

* ODBC, large objects and tracing
@ 1999-12-21 07:47 Eliot Cline <eliotcline@hotmail.com>
  1999-12-22 17:59 ` Re: [INTERFACES] ODBC, large objects and tracing Joe Shevland <shevlandj@kpi.com.au>
  0 siblings, 1 reply; 3+ messages in thread

From: Eliot Cline @ 1999-12-21 07:47 UTC (permalink / raw)
  To: pgsql-interfaces

Hi,

I am porting an application from Win NT to Linux. It is an application for 
storing, querying, subsetting and exporting geographic data. On NT the data 
is stored in MS SQL Server, database access is handled through a dll which 
handles all requests for data from the application. The dll is written using 
ODBC 3 as the interface to SQL Server.

I installed postgresql 6.53 a few days ago and had a go at getting the dll 
code working with the postgresql odbc driver. As the driver is written for 
odbc 2.0, I decided to try the UnixOdbc driver and driver manager. Using 
their package my code compiled perfectly, with NO modifications.

However, I immediatley ran into trouble when inserting into large-objects 
(Lot's of blobs in this app!). In the server trace there was an error to the 
effect of "Invalid large object descriptor".

That had me stumped until yesterday, when I ran across a patch for the ODBC 
driver on this mailing list (dated Dec. 8, 99). I applied the patch (by 
hand) to the UnixODBC version of the postgres driver, and the problem went 
away. I'm impressed! I thought it was going to be way more difficult than 
this.

If anyone is interested, I would be happy to supply the modified source 
files for the driver and a script I cobbled together to add the large object 
support functions, data type and table trigger (for deleting lo's). It all 
seems to work quite well.

I do have a couple of questions. What datatype does SQL_VARBINARY map to in 
postgresql? I searched the driver header files and came up with "bytea". But 
when I try to use it by binding my binary data to a parameter in the insert 
statement and then calling SQLExecute, SQLPutDate, etc., all I get is an 
SQL_ERROR return value from SQLExecute.

Finally, as lame as it sounds, I can't figure out how to make the odbc trace 
work! I've set TRACE = yes and specified a tracefile located in the postgres 
home directory. It is always empty. Have I missed something obvious?

Thanks,

Eliot Cline
IT Systems Manager
Intercontinental Sourcing and Services, Ltd.
Bangkok, Thailand
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [INTERFACES] ODBC, large objects and tracing
  1999-12-21 07:47 ODBC, large objects and tracing Eliot Cline <eliotcline@hotmail.com>
@ 1999-12-22 17:59 ` Joe Shevland <shevlandj@kpi.com.au>
  1999-12-22 22:58   ` Re: [INTERFACES] ODBC, large objects and tracing Peter Mount <peter@retep.org.uk>
  0 siblings, 1 reply; 3+ messages in thread

From: Joe Shevland @ 1999-12-22 17:59 UTC (permalink / raw)
  To: Eliot Cline <eliotcline@hotmail.com>; pgsql-interfaces

---- Original Message -----
From: "Eliot Cline" <eliotcline@hotmail.com>
To: <pgsql-interfaces@postgreSQL.org>
Sent: Monday, December 20, 1999 11:47 PM
Subject: [INTERFACES] ODBC, large objects and tracing


> Hi,
>
> I am porting an application from Win NT to Linux. It is an application for
> storing, querying, subsetting and exporting geographic data. On NT the
data
> is stored in MS SQL Server, database access is handled through a dll which
> handles all requests for data from the application. The dll is written
using
> ODBC 3 as the interface to SQL Server.
>
> I installed postgresql 6.53 a few days ago and had a go at getting the dll
> code working with the postgresql odbc driver. As the driver is written for
> odbc 2.0, I decided to try the UnixOdbc driver and driver manager. Using
> their package my code compiled perfectly, with NO modifications.
>
> However, I immediatley ran into trouble when inserting into large-objects
> (Lot's of blobs in this app!). In the server trace there was an error to
the
> effect of "Invalid large object descriptor".
>
> That had me stumped until yesterday, when I ran across a patch for the
ODBC
> driver on this mailing list (dated Dec. 8, 99). I applied the patch (by
> hand) to the UnixODBC version of the postgres driver, and the problem went
> away. I'm impressed! I thought it was going to be way more difficult than
> this.
>
> If anyone is interested, I would be happy to supply the modified source
> files for the driver and a script I cobbled together to add the large
object
> support functions, data type and table trigger (for deleting lo's). It all
> seems to work quite well.
>

I'd definitely like to have a look at the script that was cobbled together
to add all that... I've been having troubles but its with the JDBC driver
and large objects, but I think its just that I haven't done all thats
necessary on the postgres side to enable it.


Cheers,
Joe.





^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [INTERFACES] ODBC, large objects and tracing
  1999-12-21 07:47 ODBC, large objects and tracing Eliot Cline <eliotcline@hotmail.com>
  1999-12-22 17:59 ` Re: [INTERFACES] ODBC, large objects and tracing Joe Shevland <shevlandj@kpi.com.au>
@ 1999-12-22 22:58   ` Peter Mount <peter@retep.org.uk>
  0 siblings, 0 replies; 3+ messages in thread

From: Peter Mount @ 1999-12-22 22:58 UTC (permalink / raw)
  To: Joe Shevland <shevlandj@kpi.com.au>; +Cc: Eliot Cline <eliotcline@hotmail.com>; pgsql-interfaces

On Wed, 22 Dec 1999, Joe Shevland wrote:

> > I am porting an application from Win NT to Linux. It is an application for
> > storing, querying, subsetting and exporting geographic data. On NT the
> data
> > is stored in MS SQL Server, database access is handled through a dll which
> > handles all requests for data from the application. The dll is written
> using
> > ODBC 3 as the interface to SQL Server.
> >
> > I installed postgresql 6.53 a few days ago and had a go at getting the dll
> > code working with the postgresql odbc driver. As the driver is written for
> > odbc 2.0, I decided to try the UnixOdbc driver and driver manager. Using
> > their package my code compiled perfectly, with NO modifications.
> >
> > However, I immediatley ran into trouble when inserting into large-objects
> > (Lot's of blobs in this app!). In the server trace there was an error to
> the
> > effect of "Invalid large object descriptor".
> >
> > That had me stumped until yesterday, when I ran across a patch for the
> ODBC
> > driver on this mailing list (dated Dec. 8, 99). I applied the patch (by
> > hand) to the UnixODBC version of the postgres driver, and the problem went
> > away. I'm impressed! I thought it was going to be way more difficult than
> > this.
> >
> > If anyone is interested, I would be happy to supply the modified source
> > files for the driver and a script I cobbled together to add the large
> object
> > support functions, data type and table trigger (for deleting lo's). It all
> > seems to work quite well.

Theres an example trigger to automatically delete lo's when the row
containing a reference to them is deleted in the source tree, under
contrib/lo.

> I'd definitely like to have a look at the script that was cobbled together
> to add all that... I've been having troubles but its with the JDBC driver
> and large objects, but I think its just that I haven't done all thats
> necessary on the postgres side to enable it.

Lo's should be useable from the outset, except that you need to
setAutoCommit(false) to enable transactions. LO's can't be used outside of
a transaction.

If you still have problems with JDBC & LO's, let me know.

Peter

--
       Peter T Mount peter@retep.org.uk
      Main Homepage: http://www.retep.org.uk
PostgreSQL JDBC Faq: http://www.retep.org.uk/postgres
 Java PDF Generator: http://www.retep.org.uk/pdf




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~1999-12-22 22:58 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-12-21 07:47 ODBC, large objects and tracing Eliot Cline <eliotcline@hotmail.com>
1999-12-22 17:59 ` Joe Shevland <shevlandj@kpi.com.au>
1999-12-22 22:58   ` Peter Mount <peter@retep.org.uk>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox