Tobe,
Not in the CREATE -- in the INSERT:
<sql name="insertMessageSQL">
INSERT INTO ${table} (message_name, repository_name, message_state,
error_message, sender, recipients, remote_host, remote_addr, last_updated,
message_body) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
</sql>
As you notice, the order of the last two fields is different between the
field list specified in record insertion, and table creation.
--- Noel
-----Original Message-----
From: tobe [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 24, 2002 11:26
To: James Users List
Subject: Re: James 2.1 & PostgreSQL Store Mail Repository
The CREATE TABLE statement below is probably wrong if field 9 should be
non-text.
Actually message_body is the 9th field below, so probably the real field
9 is missing.
/tobe
Noel J. Bergman wrote:
>If you look at
>org.apache.james.mailrepository.JDBCMailRepository.store(MailImpl), you
will
>find a series of PreparedStatement.setX statements. There is only one
entry
>that is of a non-text type, and that is field 9. The message body is field
>10, and is set directly from a stream. If there were an off-by-one error
in
>the JDBC driver (0 based instead of 1 based), it might account for that
>problem. Do you have the source for their JDBC driver to check it?
>
>I see that you added a new create table statement to sqlResources.xml for
>PostgreSQL:
>
> CREATE TABLE ${table} (
> message_name varchar (200) NOT NULL,
> repository_name varchar (255) NOT NULL,
> message_state varchar (30) NOT NULL ,
> error_message varchar (1000) NULL ,
> sender varchar (255) NULL ,
> recipients text NOT NULL ,
> remote_host varchar (255) NOT NULL ,
> remote_addr varchar (20) NOT NULL ,
> message_body bytea NOT NULL ,
> last_updated date NOT NULL,
> CONSTRAINT PK_${table} PRIMARY KEY
> (
> message_name,
> repository_name
> )
> )
>
>I don't spot anything wrong, but then again, I don't use PostgreSQL. You
>might also take a look at InsertMessageSQL, which is where the field names
>and order are laid out.
>
> --- Noel
>
>-----Original Message-----
>From: Miroslav Nachev [mailto:[EMAIL PROTECTED]]
>Sent: Friday, December 20, 2002 5:29
>To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>Subject: James 2.1 & PostgreSQL Store Mail Repository
>
>
> Hi,
>
> We try to start James 2.1 with PostgreSQL but we have some problems
>with storing of mails in the database. The error is very strange
>because the field "message_body" is from type "bytea" (long binary
>data) but the error is:
> java.lang.RuntimeException: Exception caught while storing mail
> Container:
> java.sql.SQLException: ERROR:
> column "message_body" is of type 'bytea' but expression is of
> type 'integer'
> You will need to rewrite or cast the expression
>
>
> Regards,
> Miro.
>
>
>--
>To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>
>
>
>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>