db-ddlutils-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason <jeac...@hardlight.com.au>
Subject Re: postgres bytea broken
Date Wed, 12 Apr 2006 13:19:25 GMT
ok,
	I tried this:

> 	    <writeDataToFile
> 	    	outputFile="${database.backup.path}/src/schema/${database.backup.path}-data.xml">
> 	    	<converter jdbcType="BINARY" className="org.apache.ddlutils.io.converters.ByteArrayBase64Converter"/>

> 	    </writeDataToFile>	

with the latest jdbc driver but no luck.
throws exceptions of various ilks - Itried trapping themm and chasing a 
bit but it doesnt seem that a byte[] is even passed - maybe - dunno, I'm 
tired.

stack trace:
> 
> Class org.apache.ddlutils.dynabean.SqlDynaBean loaded from ant loader (parentFirst)
> Finding class org.postgresql.util.PGbytea
> Loaded from /home/jason/manifest/setup/setuplib/postgresql-8.2dev-501.jdbc3.jar org/postgresql/util/PGbytea.class
> Class org.postgresql.util.PGbytea loaded from ant loader (parentFirst)
> Finding class org.postgresql.jdbc2.TimestampUtils$ParsedTimestamp
> Loaded from /home/jason/manifest/setup/setuplib/postgresql-8.2dev-501.jdbc3.jar org/postgresql/jdbc2/TimestampUtils$ParsedTimestamp.class
> Class org.postgresql.jdbc2.TimestampUtils$ParsedTimestamp loaded from ant loader (parentFirst)
> Class java.util.TimeZone loaded from parent loader (parentFirst)
> Finding class org.apache.commons.codec.binary.Base64
> Loaded from /home/jason/manifest/setup/setuplib/commons-codec-1.3.jar org/apache/commons/codec/binary/Base64.class
> Finding class org.apache.commons.codec.BinaryEncoder
> Loaded from /home/jason/manifest/setup/setuplib/commons-codec-1.3.jar org/apache/commons/codec/BinaryEncoder.class
> Finding class org.apache.commons.codec.Encoder
> Loaded from /home/jason/manifest/setup/setuplib/commons-codec-1.3.jar org/apache/commons/codec/Encoder.class
> Class org.apache.commons.codec.Encoder loaded from ant loader (parentFirst)
> Class org.apache.commons.codec.BinaryEncoder loaded from ant loader (parentFirst)
> Finding class org.apache.commons.codec.BinaryDecoder
> Loaded from /home/jason/manifest/setup/setuplib/commons-codec-1.3.jar org/apache/commons/codec/BinaryDecoder.class
> Finding class org.apache.commons.codec.Decoder
> Loaded from /home/jason/manifest/setup/setuplib/commons-codec-1.3.jar org/apache/commons/codec/Decoder.class
> Class org.apache.commons.codec.Decoder loaded from ant loader (parentFirst)
> Class org.apache.commons.codec.BinaryDecoder loaded from ant loader (parentFirst)
> Class org.apache.commons.codec.binary.Base64 loaded from ant loader (parentFirst)
> Finding class org.apache.commons.codec.EncoderException
> Loaded from /home/jason/manifest/setup/setuplib/commons-codec-1.3.jar org/apache/commons/codec/EncoderException.class
> Class org.apache.commons.codec.EncoderException loaded from ant loader (parentFirst)
> Finding class org.apache.commons.codec.DecoderException
> Loaded from /home/jason/manifest/setup/setuplib/commons-codec-1.3.jar org/apache/commons/codec/DecoderException.class
> Class org.apache.commons.codec.DecoderException loaded from ant loader (parentFirst)
> 
> BUILD FAILED
> /home/jason/manifest/setup/setup.xml:385: java.lang.NullPointerException
>         at org.apache.ddlutils.task.WriteDataToFileCommand.execute(WriteDataToFileCommand.java:88)
>         at org.apache.ddlutils.task.DatabaseTaskBase.executeCommands(DatabaseTaskBase.java:198)
>         at org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:222)
>         at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>         at org.apache.tools.ant.Task.perform(Task.java:364)
>         at org.apache.tools.ant.Target.execute(Target.java:341)
>         at org.apache.tools.ant.Target.performTasks(Target.java:369)
>         at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
>         at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
>         at org.apache.tools.ant.Main.runBuild(Main.java:668)
>         at org.apache.tools.ant.Main.startAnt(Main.java:187)
>         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
>         at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
> Caused by: java.lang.NullPointerException
>         at org.apache.commons.codec.binary.Base64.discardNonBase64(Base64.java:474)
>         at org.apache.commons.codec.binary.Base64.decodeBase64(Base64.java:374)
>         at org.apache.ddlutils.io.converters.ByteArrayBase64Converter.convertToString(ByteArrayBase64Converter.java:48)
>         at org.apache.ddlutils.io.DataWriter.write(DataWriter.java:251)
>         at org.apache.ddlutils.io.DataWriter.write(DataWriter.java:307)
>         at org.apache.ddlutils.task.WriteDataToFileCommand.execute(WriteDataToFileCommand.java:82)
>         ... 14 more
> --- Nested Exception ---
> java.lang.NullPointerException
>         at org.apache.commons.codec.binary.Base64.discardNonBase64(Base64.java:474)
>         at org.apache.commons.codec.binary.Base64.decodeBase64(Base64.java:374)
>         at org.apache.ddlutils.io.converters.ByteArrayBase64Converter.convertToString(ByteArrayBase64Converter.java:48)
>         at org.apache.ddlutils.io.DataWriter.write(DataWriter.java:251)
>         at org.apache.ddlutils.io.DataWriter.write(DataWriter.java:307)
>         at org.apache.ddlutils.task.WriteDataToFileCommand.execute(WriteDataToFileCommand.java:82)
>         at org.apache.ddlutils.task.DatabaseTaskBase.executeCommands(DatabaseTaskBase.java:198)
>         at org.apache.ddlutils.task.DatabaseTaskBase.execute(DatabaseTaskBase.java:222)
>         at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
>         at org.apache.tools.ant.Task.perform(Task.java:364)
>         at org.apache.tools.ant.Target.execute(Target.java:341)
>         at org.apache.tools.ant.Target.performTasks(Target.java:369)
>         at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
>         at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
>         at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
>         at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
>         at org.apache.tools.ant.Main.runBuild(Main.java:668)
>         at org.apache.tools.ant.Main.startAnt(Main.java:187)
>         at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
> :




Thomas Dudziak wrote:
> On 4/12/06, Jason <jeacott@hardlight.com.au> wrote:
> 
>>         I'm currently using pg74.216.jdbc3.jar as the postgres jdbc driver.
>> *note this works fine in my application for eg
>> rs.getBlob(1).getBinaryStream()
> 
> you should definitely use the newest stable driver available (8.1 I think).
> 
>>   I looked at converter, but since I didnt have a readytogo class I
>> didnt pursue it, also I have quite a few tables and many bytea type
>> fields all of which would need to be individually handled this way. I
>> was hoping to avoid that.
> 
> You only need to add the converter sub-element in the Ant task, and
> the one pre-defined converter that I pointed you to might actually do
> the trick.
> 
>> is there anyway to force it top be recognised as a Blob instead?
> 
> nope, the jdbc driver flags it as BINARY, not LONGVARBINARY or BLOB.
> 
>> presumable the byte[] returned is complete and that wouldnt be good for
>> out of mem problems with large datafields (plus the jdbc driver is very
>> evil in that it also doesn't nicely stream when asked, instead it also
>> buffers the complete field in ram at least once, and probably does a few
>> nasty copies for fun.)
> 
> since the 7.4 driver there have been numerous fixes and enhancements
> in the postgres driver, so you should definitely try a newer one.
> 
> Tom
> 

Mime
View raw message