You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Russ Ochsner <ru...@ochsner.net> on 2004/04/25 22:06:09 UTC

James and PostgreSQL 7.4.1

I am unable to get James < 3.0 to work out of the box with Postgresql 
7.4.1 on Win2k (current Cygwin port) or MacOS X (JDBC v3 build 213) 
using Java 1.4.0 and 1.4.2 respectively.

I receive errors such as: spoolmanager.root: Exception calling 
RelayLimit: Unable to parse headers from stream: 
org.postgresql.util.PSQLException: Bad Integer Return-Path:...

I'm not sure if this is unique to my situation or if I am just 
overlooking something in the documentation, perhaps sqlResources.xml 
file?

In order for me to use PostgreSQL I had to modify 
org.apache.james.mailrepository.JDBCMailRepository.java and 
org.apache.james.mailrepository.MimeMessageJDBCSource.java. It appears 
that the PostgreSQL JDBC driver's Blob class does not support a bytea 
data type.



PostgreSQL works ok with these changes:


Re: James and PostgreSQL 7.4.1

Posted by Serge Knystautas <se...@lokitech.com>.
Arjan Veenstra wrote:
> I tried changing the type from bytea to oid, PostgreSQL's blob type. This 
> doesn't help much since James now failed to store the message to the spool.
> Both JDBC drivers seem, from what I've read in the docs, to agree that the 
> java blob type matches oid and that bytea is matched by byte array's. 
> Looking at the code you can see that a blob is used to retrieve the message 
> while a byte array is used to store it. For now my guess is that both blobs 
> and byte arrays will work as long as the same thing for both storing and 
> retrieving the message, wich is a good thing anyway i guess. The PostgreSQL 
> driver might not be the only to treat these differently.

That sucks... would be nice if postgresql was usable.

> The thing could be fixed easily by a try/catch construction wich first tries 
> the blob and when it fails tries the byte array wich the old version used, 
> but it's not really a very clean solution.

Yeah, I'd rather not customize James code for bad JDBC driver impls.

> Another, somewhat related thing i noticed is the fact that Exceptions during 
> mail storage are output to the mail session. This causes a multiline response 
> in way that is irrc in violation of the SMTP rfc. Appart from the rfc 
> violation it might be a good idea to hide these exceptions anyway.

That shouldn't be happening... you should just get a single error 
response line in SMTP and then the details get sent to a log.

> Just out of curiosity, do you have any insight in what databases people use 
> with james and wheter they are all tested with the RCs?

MySQL is the main.  MS SQL and Oracle I know are also used (I used to 
use MS SQL until very recently and Oracle just had some patches come 
in).  There's a sqlResources.xml file that shows how we have custom SQL 
statements for several databases... maybe SAP DB is another we support?

-- 
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@lokitech.com

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


RE: James and PostgreSQL 7.4.1

Posted by "Noel J. Bergman" <no...@devtech.com>.
> I tried changing the type from bytea to oid, PostgreSQL's blob type. This
> doesn't help much since James now failed to store the message to the
spool.

I haven't looked.  Matching change needed on the store side?

> The thing could be fixed easily by a try/catch construction wich first
> tries the blob and when it fails tries the byte array wich the old
> version used, but it's not really a very clean solution.

No it isn't, but I'd like to support the wider range if we can.

> Another, somewhat related thing i noticed is the fact that Exceptions
during
> mail storage are output to the mail session. This causes a multiline
> response in way that is irrc in violation of the SMTP rfc.

Please submit a bug report, preferably with a short patch.

> Just out of curiosity, do you have any insight in what databases people
> use with james and wheter they are all tested with the RCs?

They get tested on whatever people run them on.  I, personally, use MySQL in
production and testing.  I think that some others use MSSQL.  Your guess is
as good as mine for which databases are getting tested each time.  We don't
have any formal testing volunteers.  Apparently, Oracle, DB2 and PostgreSQL
do get tested because Steve Short posted the fix for the first two, and two
of you have since run into a problem with PostgreSQL due to the fix.

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: James and PostgreSQL 7.4.1

Posted by Arjan Veenstra <av...@avee.org>.
On Monday 26 April 2004 06:40 am, Noel J. Bergman wrote:
> > I did not yet try to change table types, but i will do so as soon
> > as i find the time.
>
> Thanks.
>

I tried changing the type from bytea to oid, PostgreSQL's blob type. This 
doesn't help much since James now failed to store the message to the spool.
Both JDBC drivers seem, from what I've read in the docs, to agree that the 
java blob type matches oid and that bytea is matched by byte array's. 
Looking at the code you can see that a blob is used to retrieve the message 
while a byte array is used to store it. For now my guess is that both blobs 
and byte arrays will work as long as the same thing for both storing and 
retrieving the message, wich is a good thing anyway i guess. The PostgreSQL 
driver might not be the only to treat these differently.

The thing could be fixed easily by a try/catch construction wich first tries 
the blob and when it fails tries the byte array wich the old version used, 
but it's not really a very clean solution.

Another, somewhat related thing i noticed is the fact that Exceptions during 
mail storage are output to the mail session. This causes a multiline response 
in way that is irrc in violation of the SMTP rfc. Appart from the rfc 
violation it might be a good idea to hide these exceptions anyway.

Just out of curiosity, do you have any insight in what databases people use 
with james and wheter they are all tested with the RCs?

Greetings,
AVee




---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


RE: James and PostgreSQL 7.4.1

Posted by "Noel J. Bergman" <no...@devtech.com>.
> I'm getting the exact same error on debian stable, james 2.2.0RC2,
> pgsql 7.2.1.

> I tried the org.sourceforge.jxdbcon.JXDBConDriver but that only
> changed the exception

Well, thanks for trying it.

> jxutil.sql.I18nSQLException: noConversion[getBlob, bytea, LONGVARBINARY];

> I did not yet try to change table types, but i will do so as soon
> as i find the time.

Thanks.

	--- Noel

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: James and PostgreSQL 7.4.1

Posted by Arjan Veenstra <av...@avee.org>.
On Sunday 25 April 2004 10:06 pm, Russ Ochsner wrote:
> I am unable to get James < 3.0 to work out of the box with Postgresql
> 7.4.1 on Win2k (current Cygwin port) or MacOS X (JDBC v3 build 213)
> using Java 1.4.0 and 1.4.2 respectively.
>
> I receive errors such as: spoolmanager.root: Exception calling
> RelayLimit: Unable to parse headers from stream:
> org.postgresql.util.PSQLException: Bad Integer Return-Path:...
>
I'm getting the exact same error on debian stable, james 2.2.0RC2, pgsql 
7.2.1. So at least you're not alone ;)

I tried the org.sourceforge.jxdbcon.JXDBConDriver but that only changed the 
exception: 
26/04/04 00:56:13 ERROR spoolmanager.root: Exception calling RelayLimit: 
Unable to parse headers from stream: org.sourceforge.
jxutil.sql.I18nSQLException: noConversion[getBlob, bytea, LONGVARBINARY];
  nested exception is:
        java.io.IOException: org.sourceforge.jxutil.sql.I18nSQLException: 
noConversion[getBlob, bytea, LONGVARBINARY]
...

I did not yet try to change table types, but i will do so as soon as i find 
the time. I really need to get some sleep first :)

AVee

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


RE: James and PostgreSQL 7.4.1

Posted by "Noel J. Bergman" <no...@devtech.com>.
Russ,

Please see http://james.apache.org/contribute.html.  Getting patches in the
right format really helps.

Unfortunately, though, it appears that you want to reverse these changes:


http://cvs.apache.org/viewcvs.cgi/james-server/src/java/org/apache/james/mai
lrepository/JDBCMailRepository.java?r1=1.30.4.14&r2=1.30.4.15&diff_format=h&
only_with_tag=branch_2_1_fcs


http://cvs.apache.org/viewcvs.cgi/james-server/src/java/org/apache/james/mai
lrepository/MimeMessageJDBCSource.java?r1=1.10.4.4&r2=1.10.4.5&diff_format=h
&only_with_tag=branch_2_1_fcs

which fix http://issues.apache.org/jira/browse/JAMES-247.  Is that right?

> I'm not sure if this is unique to my situation or if I am just
> overlooking something in the documentation, perhaps
> sqlResources.xml file?

You can look to see if changing the table definition for PostgreSQL would
help.

> It appears that the PostgreSQL JDBC driver's Blob class does not
> support a bytea data type.

As I understand it, many people have some scathing remarks to make regarding
the quality of the PostgreSQL JDBC driver.  There are mentions of
work-arounds, so you might read:

  http://www.castor.org/postgresql-blobs.html
  http://hypermail.linklord.com/castor-dev.old/2002/Aug/0988.html

Apparently, http://jxdbcon.sourceforge.net/ provides a JDBC driver for
PostgreSQL that actually works
(http://sourceforge.net/forum/forum.php?forum_id=349130).  My suggestion
would be that you give that a try, and let us know.

	--- Noel


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org