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 Michael Baehr <co...@googlemail.com> on 2007/02/20 18:42:49 UTC

Postgresql 8.1

Hi there,

I got James (trunk) running successfully. Now I wanted to replace the 
default Derby database with  Postgresql 8.1.

I made the necessary changes in the config.xml (so far only in the 
Mailboxmanager-Section, as I'm using IMAP), but I get a NPE:

java.lang.NullPointerException
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.replaceProcessing(AbstractJdbc2Statement.java:765)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:338)
        at 
org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:286)
        at 
org.apache.torque.util.BasePeer.executeStatement(BasePeer.java:1292)
        at 
org.apache.james.mailboxmanager.torque.TorqueMailboxManagerFactory.initialize(TorqueMailboxManagerFactory.java:109)

My section in config.xml:

                        <torque-properties>
                            <property name="torque.database.default"
                                value="mailboxmanager"/>
                            <property
                                
name="torque.database.mailboxmanager.adapter"
                                value="postgresql"/>
                            <property
                                
name="torque.dsfactory.mailboxmanager.factory"
                                
value="org.apache.torque.dsfactory.SharedPoolDataSourceFactory"/>
                            <property
                                
name="torque.dsfactory.mailboxmanager.connection.driver"
                                value="org.postgresql.Driver"/>
                            <property
                                
name="torque.dsfactory.mailboxmanager.connection.url"
                                value="jdbc:postgresql://localhost/james"/>
                            <property
                                
name="torque.dsfactory.mailboxmanager.connection.user"
                                value="james"/>
                            <property
                                
name="torque.dsfactory.mailboxmanager.connection.password"
                                value="james"/>
                            <property
                                
name="torque.dsfactory.mailboxmanager.pool.maxActive"
                                value="100"/>
                        </torque-properties>

Do I have to create the database tables myself? If yes, how?

Michael


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


Re: Postgresql 8.1

Posted by Michael Baehr <co...@googlemail.com>.
Oh, I just see that in mailboxManagerSqlResources.xml there is nothing 
for Postgresql!

Does somebody (Norman?) have the correct SQL statements (I'm not a DB 
expert at all)?

Michael

Michael Baehr schrieb:
> Hi there,
>
> I got James (trunk) running successfully. Now I wanted to replace the 
> default Derby database with  Postgresql 8.1.
>
> I made the necessary changes in the config.xml (so far only in the 
> Mailboxmanager-Section, as I'm using IMAP), but I get a NPE:
>
> java.lang.NullPointerException
>        at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.replaceProcessing(AbstractJdbc2Statement.java:765) 
>
>        at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:338) 
>
>        at 
> org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:286) 
>
>        at 
> org.apache.torque.util.BasePeer.executeStatement(BasePeer.java:1292)
>        at 
> org.apache.james.mailboxmanager.torque.TorqueMailboxManagerFactory.initialize(TorqueMailboxManagerFactory.java:109) 
>
>
> My section in config.xml:
>
>                        <torque-properties>
>                            <property name="torque.database.default"
>                                value="mailboxmanager"/>
>                            <property
>                                
> name="torque.database.mailboxmanager.adapter"
>                                value="postgresql"/>
>                            <property
>                                
> name="torque.dsfactory.mailboxmanager.factory"
>                                
> value="org.apache.torque.dsfactory.SharedPoolDataSourceFactory"/>
>                            <property
>                                
> name="torque.dsfactory.mailboxmanager.connection.driver"
>                                value="org.postgresql.Driver"/>
>                            <property
>                                
> name="torque.dsfactory.mailboxmanager.connection.url"
>                                
> value="jdbc:postgresql://localhost/james"/>
>                            <property
>                                
> name="torque.dsfactory.mailboxmanager.connection.user"
>                                value="james"/>
>                            <property
>                                
> name="torque.dsfactory.mailboxmanager.connection.password"
>                                value="james"/>
>                            <property
>                                
> name="torque.dsfactory.mailboxmanager.pool.maxActive"
>                                value="100"/>
>                        </torque-properties>
>
> Do I have to create the database tables myself? If yes, how?
>
> Michael
>
>

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


Re: Postgresql 8.1

Posted by Michael Baehr <co...@googlemail.com>.
Hi Norman,

I tried some things yesterday, but the results are not really 
encouraging :-(

The database tables for Postgresql must use
- bytea instead of blob
- boolean instead of the integers in message_flags
- serial instead of the autoincrement

The last point (serial) imposes a big problem. IMHO, the Torque adapter 
for Postgresql is severely flawed in that regard!

Torque tries to access the sequence associated with a table to get the 
current id. In Postgresql, the default name for the sequence is 
"tablename_columnname_seq". For the mailbox table this means the 
sequence is named "mailbox_mailbox_id_seq".

Unfortunately, the Postgresql adapter tries to access it by the name 
"mailbox". Not even creating a sequence manually can help here, as 
Postgresql doesn't allow the same name for a table and a sequence!

A workaround would be to use Torque generated ids instead of "NATIVE" as 
it is in the sources. But theses source files seem to be generated by 
Torque, so I didn't want to fiddle with them.

I didn't give up, though, and tried to use an own version of the adapter 
...

I was able to fix this specific problem, and James runs now without any 
error messages. Unfortunately, it doesn't store any messages in the 
database either ...

I'm not sure if I want to invest more time into this problem, because to 
me it seems like Torque and Postgresql are not a good combination in the 
first place! I need to get James running as my main mail server in the 
next 2 - 3 weeks, and as the IMAP support is only experimental I don't 
want to use an unsupported database underneath.

Still, do you know how to make Torque log the SQL statements it produces?

Michael

Norman Maurer schrieb:
> Hi Michael,
>
> i have not postgresql db to test at the moment. But you can give the
> attached diff a try. Please give us feedback .
>
> Bye
> Norman
>
> Michael Baehr schrieb:
>   
>> Oh, I just see that in mailboxManagerSqlResources.xml there is nothing
>> for Postgresql!
>>
>> Does somebody (Norman?) have the correct SQL statements (I'm not a DB
>> expert at all)?
>>
>> Michael
>>
>> Michael Baehr schrieb:
>>     
>>> Hi there,
>>>
>>> I got James (trunk) running successfully. Now I wanted to replace the
>>> default Derby database with  Postgresql 8.1.
>>>
>>> I made the necessary changes in the config.xml (so far only in the
>>> Mailboxmanager-Section, as I'm using IMAP), but I get a NPE:
>>>
>>> java.lang.NullPointerException
>>>        at
>>> org.postgresql.jdbc2.AbstractJdbc2Statement.replaceProcessing(AbstractJdbc2Statement.java:765)
>>>
>>>        at
>>> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:338)
>>>
>>>        at
>>> org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:286)
>>>
>>>        at
>>> org.apache.torque.util.BasePeer.executeStatement(BasePeer.java:1292)
>>>        at
>>> org.apache.james.mailboxmanager.torque.TorqueMailboxManagerFactory.initialize(TorqueMailboxManagerFactory.java:109)
>>>
>>>
>>> My section in config.xml:
>>>
>>>                        <torque-properties>
>>>                            <property name="torque.database.default"
>>>                                value="mailboxmanager"/>
>>>                            <property
>>>                               
>>> name="torque.database.mailboxmanager.adapter"
>>>                                value="postgresql"/>
>>>                            <property
>>>                               
>>> name="torque.dsfactory.mailboxmanager.factory"
>>>                               
>>> value="org.apache.torque.dsfactory.SharedPoolDataSourceFactory"/>
>>>                            <property
>>>                               
>>> name="torque.dsfactory.mailboxmanager.connection.driver"
>>>                                value="org.postgresql.Driver"/>
>>>                            <property
>>>                               
>>> name="torque.dsfactory.mailboxmanager.connection.url"
>>>                               
>>> value="jdbc:postgresql://localhost/james"/>
>>>                            <property
>>>                               
>>> name="torque.dsfactory.mailboxmanager.connection.user"
>>>                                value="james"/>
>>>                            <property
>>>                               
>>> name="torque.dsfactory.mailboxmanager.connection.password"
>>>                                value="james"/>
>>>                            <property
>>>                               
>>> name="torque.dsfactory.mailboxmanager.pool.maxActive"
>>>                                value="100"/>
>>>                        </torque-properties>
>>>
>>> Do I have to create the database tables myself? If yes, how?
>>>
>>> Michael
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
>> !EXCUBATOR:1,45db389c39079122512689!
>>     
>
>
>   
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org

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


Re: Postgresql 8.1

Posted by Norman Maurer <nm...@byteaction.de>.
Hi Michael,

i have not postgresql db to test at the moment. But you can give the
attached diff a try. Please give us feedback .

Bye
Norman

Michael Baehr schrieb:
> Oh, I just see that in mailboxManagerSqlResources.xml there is nothing
> for Postgresql!
>
> Does somebody (Norman?) have the correct SQL statements (I'm not a DB
> expert at all)?
>
> Michael
>
> Michael Baehr schrieb:
>> Hi there,
>>
>> I got James (trunk) running successfully. Now I wanted to replace the
>> default Derby database with  Postgresql 8.1.
>>
>> I made the necessary changes in the config.xml (so far only in the
>> Mailboxmanager-Section, as I'm using IMAP), but I get a NPE:
>>
>> java.lang.NullPointerException
>>        at
>> org.postgresql.jdbc2.AbstractJdbc2Statement.replaceProcessing(AbstractJdbc2Statement.java:765)
>>
>>        at
>> org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:338)
>>
>>        at
>> org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:286)
>>
>>        at
>> org.apache.torque.util.BasePeer.executeStatement(BasePeer.java:1292)
>>        at
>> org.apache.james.mailboxmanager.torque.TorqueMailboxManagerFactory.initialize(TorqueMailboxManagerFactory.java:109)
>>
>>
>> My section in config.xml:
>>
>>                        <torque-properties>
>>                            <property name="torque.database.default"
>>                                value="mailboxmanager"/>
>>                            <property
>>                               
>> name="torque.database.mailboxmanager.adapter"
>>                                value="postgresql"/>
>>                            <property
>>                               
>> name="torque.dsfactory.mailboxmanager.factory"
>>                               
>> value="org.apache.torque.dsfactory.SharedPoolDataSourceFactory"/>
>>                            <property
>>                               
>> name="torque.dsfactory.mailboxmanager.connection.driver"
>>                                value="org.postgresql.Driver"/>
>>                            <property
>>                               
>> name="torque.dsfactory.mailboxmanager.connection.url"
>>                               
>> value="jdbc:postgresql://localhost/james"/>
>>                            <property
>>                               
>> name="torque.dsfactory.mailboxmanager.connection.user"
>>                                value="james"/>
>>                            <property
>>                               
>> name="torque.dsfactory.mailboxmanager.connection.password"
>>                                value="james"/>
>>                            <property
>>                               
>> name="torque.dsfactory.mailboxmanager.pool.maxActive"
>>                                value="100"/>
>>                        </torque-properties>
>>
>> Do I have to create the database tables myself? If yes, how?
>>
>> Michael
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
> !EXCUBATOR:1,45db389c39079122512689!


-- 
Mit freundlichen Gr��en 

i.A. Norman Maurer 
Systemadministrator

ByteAction GmbH
Auf der Beune 83-85
64839 M�nster

Phone:   +49 (0) 60 71 92 16 - 21
Fax:       +49 (0) 60 71 92 16 - 20
E-mail:    nm@byteaction.de
Internet: www.byteaction.de
AG Darmstadt, HRB 33271
Ust-Id: DE206997247
GF: Thomas Volkert
------------------------------------------------------ 
Diese E-Mail enth�lt vertrauliche Informationen und ist nur f�r den in der E-Mail genannten Adressaten bestimmt. F�r den Fall, dass der Empf�nger dieser E-Mail nicht der in der E-Mail benannte Adressat ist, weisen wir darauf hin, dass das Lesen, Kopieren, die Wiedergabe, Verbreitung, Vervielf�ltigung, Bekanntmachung, Ver�nderung, Verteilung und/oder Ver�ffentlichung der E-Mail strengstens untersagt ist. Bitte verst�ndigen Sie den Absender dieser E-Mail unter folgender Rufnummer +49 (0) 6071 / 9216-0, falls Sie irrt�mlich diese E-Mail erhalten haben und l�schen Sie diese E-Mail. Der Inhalt dieser E-Mail ist nur rechtsverbindlich, wenn er von unserer Seite schriftlich durch Brief oder Telefax best�tigt wird. Die Versendung von E-Mails an uns hat keine fristwahrende Wirkung. 

This e-mail contains information which is privileged and is intended only for the Addressee named in the e-mail. In case that the recipient of this e-mail is not the named addressee, we would like to inform you that it is strictly prohibited to read, to reproduce, to disseminate, to copy, to disclose, to modify, to distribute and/or to publish this e-mail. If you have received this e-mail in error, please call the sender under following telephone number +49 (0) 6071 / 9216-0 and delete this e-mail. The content of this e-mail is not legally binding unless confirmed by letter or telefax. E-mails which are sent to us do not constitute compliance with any time limits or deadlines.
------------------------------------------------------