Received: from piglet.dstc.edu.au (piglet.dstc.edu.au [130.102.176.1]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f585UkE52022 for ; Fri, 8 Jun 2001 01:30:47 -0400 (EDT) (envelope-from crawley@dstc.edu.au) Received: from dstc.edu.au (soluble.dstc.edu.au [130.102.176.43]) by piglet.dstc.edu.au (8.11.3/8.11.3) with ESMTP id f585UO601918; Fri, 8 Jun 2001 15:30:24 +1000 (EST) Message-Id: <200106080530.f585UO601918@piglet.dstc.edu.au> X-Mailer: exmh version 2.2 06/23/2000 with nmh-1.0.4 To: Ricardo Maia cc: pgsql-interfaces@postgresql.org, crawley@dstc.edu.au Subject: Re: Using BLOBs with several DBMS In-Reply-To: Message from Ricardo Maia of "Tue, 29 May 2001 15:04:52 +0100." <01052915045203.13393@valkyrie> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 08 Jun 2001 15:30:26 +1000 From: Stephen Crawley X-Scanned-By: MIMEDefang 1.0 (http://www.roaringpenguin.com/mimedefang/) X-Archive-Number: 200106/34 X-Sequence-Number: 1696 > My question is: how can i create a table with one BLOB field, in a DBMS > independent way? > > I am using PostgreSQL7.1 and Oracle 8 but I want to make it be able to work > with other DBMSs. It is difficult, because: * Different versions of SQL use different names for the BLOB type. * Some DBMS don't support blobs at all. * Some DBMS treat blobs differently to other SQL types and require you to use special APIs to access them. * Not all JDBC drivers support the JDBC 2.0 Blob APIs. Of those that do, many implement them in part only. Given this mess, you've got two choices: * Define a Java interface for all of your database interactions. Create a different implementation for each DBMS you plan to support, complete with embedded SQL statements, table schemas, etc. * Define wrapper classes for JDBC, and try to isolate the DBMS differences in "adapters". This (more or less) allows you to share SQL statements / table schemas across DBMS, but it is kind of hard getting the wrapper / adapter APIs right. -- Steve