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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> !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:    [EMAIL PROTECTED]
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.
------------------------------------------------------ 

Index: 
H:/stuff/work/workspace/james-trunk/src/conf/mailboxManagerSqlResources.xml
===================================================================
--- H:/stuff/work/workspace/james-trunk/src/conf/mailboxManagerSqlResources.xml 
(revision 506319)
+++ H:/stuff/work/workspace/james-trunk/src/conf/mailboxManagerSqlResources.xml 
(working copy)
@@ -157,6 +157,72 @@
         ON DELETE CASCADE
 ) ENGINE=INNODB;        
     </sql>  
+    
+<!-- postgresql -->
+        <sql name="createTable_mailbox" db="postgresql">
+CREATE TABLE mailbox
+(
+    mailbox_id BIGINT NOT NULL AUTO_INCREMENT,
+    name VARCHAR(255) NOT NULL,
+    uid_validity BIGINT NOT NULL,
+    last_uid BIGINT NOT NULL,
+    message_count MEDIUMINT default 0,
+    size BIGINT default 0,
+    PRIMARY KEY(mailbox_id),
+    UNIQUE (name));
+    </sql>
+    <sql name="createTable_message" db="postgresql">
+CREATE TABLE message
+(
+    mailbox_id BIGINT NOT NULL,
+    uid BIGINT NOT NULL,
+    internal_date DATETIME,
+    size BIGINT,
+    PRIMARY KEY(mailbox_id,uid),
+    FOREIGN KEY (mailbox_id) REFERENCES mailbox (mailbox_id)
+        ON DELETE CASCADE
+  );      
+    </sql>
+    <sql name="createTable_message_flags" db="postgresql">   
+CREATE TABLE message_flags
+(
+    mailbox_id BIGINT NOT NULL,
+    uid BIGINT NOT NULL,
+    answered INTEGER default 0 NOT NULL,
+    deleted INTEGER default 0 NOT NULL,
+    draft INTEGER default 0 NOT NULL,
+    flagged INTEGER default 0 NOT NULL,
+    recent INTEGER default 0 NOT NULL,
+    seen INTEGER default 0 NOT NULL,
+    PRIMARY KEY(mailbox_id,uid),
+    FOREIGN KEY (mailbox_id, uid) REFERENCES message (mailbox_id, uid)
+        ON DELETE CASCADE
+  );
+    </sql>      
+    <sql name="createTable_message_header" db="postgresql">  
+CREATE TABLE message_header
+(
+    mailbox_id BIGINT NOT NULL,
+    uid BIGINT NOT NULL,
+    line_number BIGINT NOT NULL,
+    field VARCHAR(256) NOT NULL,
+    value VARCHAR(1024) NOT NULL,
+    PRIMARY KEY(mailbox_id,uid,line_number),
+    FOREIGN KEY (mailbox_id, uid) REFERENCES message (mailbox_id, uid)
+        ON DELETE CASCADE
+  );      
+    </sql>  
+    <sql name="createTable_message_body" db="postgresql">    
+CREATE TABLE message_body
+(
+    mailbox_id BIGINT NOT NULL,
+    uid BIGINT NOT NULL,
+    body BLOB NOT NULL,
+    PRIMARY KEY(mailbox_id,uid),
+    FOREIGN KEY (mailbox_id, uid) REFERENCES message (mailbox_id, uid)
+        ON DELETE CASCADE
+);        
+    </sql>  
   </sqlDefs>
 </sqlResources>
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to