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 daniele rizzi <da...@mail.largesys.it> on 2002/01/25 09:21:53 UTC

I: PLease Help Me!!!

I hope somebody put this in a faq or the like...

Title: what happens when you implements a MailRepository under OracleDb
Refers to: James 1.2.*, Oracle Server 9i (perhaps 8i and others)

Subtitle: something went wrong, but I can't put my finger on it...

Step to replicate:
- first install james 1.2* and test everything is ok;
- then create the schema (lets say JAMES) and  the table Message in the Db,
  as sketched with mySql example;
- then change the repository def (I forgot the steps at home, but cutting &
pasting
  the mySql defs basically works);
- finally rerun james: even though evrytng is ok, deamon crashed in a weird
way,
  with the weirder exception:
2002.01.24 10:13:34 086 Channel default opened loading broker properties
from file:/var/maildatabase com.workingdogs.town.DataSetException: Error
retrieving primary keys from table
jamesusers: Unable to retrieve primary keys on table jamesusers
        at com.workingdogs.town.ConnDefinition.getSchema

What happend?:
James uses Town lib to serialize messages from / to db: Town knows there is
a table called
"Messages" to analyze before operating: the analysis looks for:
- the type and name of columns;
- the primary key(s);
Introspection is done via getDatabaseMetaData(), but the Oracle
implementation is faulty:

IF you CREATE TABLE MESSAGE(), then the catalog contains an entry MESSAGE
and getDatabaseMetaData() returns data as expected;

IF you CREATE TABLE Message(), then the catalog contains an entry MESSAGE
and getDatabaseMetaData() doesn't find the table and returns empty data;

IF at this point you're rather confused and thinks there's something rotten,
you should
re-read the above sentences thrice and accept as a fact of life:
according to Oracle Support this is *NOT* a bug, instead that's exactly the
logical behaviour (and I'd known it better and not bugged people that
works...).

Finally the solution (by dany, which is me):
you cannot change James and you cannot touch Town, and you
cannot force Oracle to support logic, but you can:

open sqlplus james/james@sid_your_db:

CREATE TABLE MESSAGES(ETC);

CREATE SYNONYM "Messages" FOR MESSAGES;

SELECT * FROM CAT;
-- you should see 2 entries: the first UPPERCASE, the second MixedCase;

COMMIT; -- it always helps;

exit sqlplus;

rerun all the testbed and james: it should work:

hope it helps,
d.




-----Messaggio originale-----
Da: Raghavender Rao [mailto:sraghav_rao@hotmail.com]
Inviato: giovedì 24 gennaio 2002 6.25
A: drizzi@largesys.it
Oggetto: PLease Help Me!!!


hi ther,

     I am trying to install JAMES with users repositories stored in
Oracle.Connection eshtablished successfully.But when i try to adduser or
listusers it gives me following Exception..

--------------------------------------------

2002.01.24 10:13:34 086 Channel default opened
loading broker properties from file:/var/maildatabase
com.workingdogs.town.DataSetException: Error retrieving primary keys from
table
jamesusers: Unable to retrieve primary keys on table jamesusers
        at
com.workingdogs.town.ConnDefinition.getSchema(ConnDefinition.java:227
)
        at com.workingdogs.town.TableDataSet.<init>(TableDataSet.java:299)
        at com.workingdogs.town.TableDataSet.<init>(TableDataSet.java:280)
        at
org.apache.james.userrepository.UsersTownRepository.countUsers(UsersT
ownRepository.java:171)
        at
org.apache.james.remotemanager.RemoteManager.parseCommand(RemoteManag
er.java:195)
        at
org.apache.james.remotemanager.RemoteManager.parseRequest(RemoteManag
er.java:117)
        at
org.apache.avalon.blocks.serversocket.ServerSocketAcceptor.run(Server
SocketAcceptor.java:77)
        at org.apache.avalon.utils.recycle.pool.Worker.run(Worker.java:113)

-----------------------------

table has primary keys but still error.

still to add

 in com.workingdogs.town.ConnDefinition class and method getSchema();

------------------------------------------------------
1.           KeyDef keydef = new KeyDef();
2.            try
3.            {
4.                Connection connection1 = getConnection();
5.                try
6.                {
7.                    DatabaseMetaData databasemetadata =
connection1.getMetaData();
8.                    ResultSet resultset1;
9.                    for(resultset1 =
databasemetadata.getPrimaryKeys(connection1.getCatalog(), null, s);
resultset1.next(); keydef.addAttrib(resultset1.getString("COLUMN_NAME")));
10.                   resultset1.close();
11.                   if(keydef.size() == 0)      // this is the cause of
the error.....
12.                       throw new DataSetException("Unable to retrieve
primary keys on table " + s);
13.                   schema.setDefaultKeyDef(keydef);
14.                   schemas.put(s, schema);
15.               }
16.               catch(Exception exception2)
17.               {
18.                   throw new DataSetException("Error retrieving primary
keys from table " + s + ": " + exception2.getMessage());
19.               }
20.               releaseConnection(connection1);
21.            }
22.           catch(Exception exception1)
23.           {
24.               if(exception1 instanceof DataSetException)
25.                   throw (DataSetException)exception1;
26.               else
27.                   throw new DataSetException("Error retrieving schema
info for table " + s + ": " + exception1.getMessage());
28.           }
29.       }
-----------------------------------------------------

 Line 11 is causing ERROR!!! the size of keydef is 0
 and i wrote a small program to test this....
-----------------------------------------------------
     try {
            java.sql.DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
            int i=0;
            java.lang.String s = "jamesusers";
            java.sql.Connection connection =
java.sql.DriverManager.getConnection("mydatabaseurl","username","password");
            java.sql.Statement statement = connection.createStatement();
            java.sql.DatabaseMetaData databasemetadata =
connection.getMetaData();
            java.sql.ResultSet resultset;
            resultset =
databasemetadata.getPrimaryKeys(connection.getCatalog(),null,s);
            java.lang.System.out.println("The Value of ResultSet is
"+resultset.next());

            /*while(resultset.next()){

               java.lang.System.out.println("The coloums are
"+resultset.getString("COLUMN_NAME"));

            }*/
        }catch(java.lang.Exception exception){

            exception.printStackTrace();
        }
-----------------------------------------------------

The output of this program is :

 The Value of ResultSet is false

I tried with different tables which has primary keys but the output is
same...

Please help me to solve this problem as soon as possible.

Rao





----------------------------------------------------------------------------
----
MSN Photos is the easiest way to share and print your photos: Click Here


R: PLease Help Me!!!

Posted by daniele rizzi <da...@mail.largesys.it>.
I don't know if UPPERCASE would solve all the trouble,
but it might be safer, taken into account that some dbserver
are so old that MixedCase is more an option than a feature.

One of these days I'll try to upgrade to james2 and I'll
write down all my steps.

thanks for listening
d.



-----Messaggio originale-----
Da: Danny Angus [mailto:danny@thought.co.uk]
Inviato: venerdì 25 gennaio 2002 10.31
A: James Users List
Oggetto: RE: PLease Help Me!!!


Thanks daniele,

Are you saying that all we have to do is make James use all uppercase for
tablenames?
If so have you tried v2 yet?

d.

> -----Original Message-----
> From: daniele rizzi [mailto:daniele.rizzi@www.largesys.it]
> Sent: Friday, January 25, 2002 8:22 AM
> To: James Users List
> Cc: sraghav_rao@hotmail.com
> Subject: I: PLease Help Me!!!
>
>
> I hope somebody put this in a faq or the like...
>
> Title: what happens when you implements a MailRepository under OracleDb
> Refers to: James 1.2.*, Oracle Server 9i (perhaps 8i and others)
>
> Subtitle: something went wrong, but I can't put my finger on it...
>
> Step to replicate:
> - first install james 1.2* and test everything is ok;
> - then create the schema (lets say JAMES) and  the table Message
> in the Db,
>   as sketched with mySql example;
> - then change the repository def (I forgot the steps at home, but
> cutting &
> pasting
>   the mySql defs basically works);
> - finally rerun james: even though evrytng is ok, deamon crashed
> in a weird
> way,
>   with the weirder exception:
> 2002.01.24 10:13:34 086 Channel default opened loading broker properties
> from file:/var/maildatabase com.workingdogs.town.DataSetException: Error
> retrieving primary keys from table
> jamesusers: Unable to retrieve primary keys on table jamesusers
>         at com.workingdogs.town.ConnDefinition.getSchema
>
> What happend?:
> James uses Town lib to serialize messages from / to db: Town
> knows there is
> a table called
> "Messages" to analyze before operating: the analysis looks for:
> - the type and name of columns;
> - the primary key(s);
> Introspection is done via getDatabaseMetaData(), but the Oracle
> implementation is faulty:
>
> IF you CREATE TABLE MESSAGE(), then the catalog contains an entry MESSAGE
> and getDatabaseMetaData() returns data as expected;
>
> IF you CREATE TABLE Message(), then the catalog contains an entry MESSAGE
> and getDatabaseMetaData() doesn't find the table and returns empty data;
>
> IF at this point you're rather confused and thinks there's
> something rotten,
> you should
> re-read the above sentences thrice and accept as a fact of life:
> according to Oracle Support this is *NOT* a bug, instead that's
> exactly the
> logical behaviour (and I'd known it better and not bugged people that
> works...).
>
> Finally the solution (by dany, which is me):
> you cannot change James and you cannot touch Town, and you
> cannot force Oracle to support logic, but you can:
>
> open sqlplus james/james@sid_your_db:
>
> CREATE TABLE MESSAGES(ETC);
>
> CREATE SYNONYM "Messages" FOR MESSAGES;
>
> SELECT * FROM CAT;
> -- you should see 2 entries: the first UPPERCASE, the second MixedCase;
>
> COMMIT; -- it always helps;
>
> exit sqlplus;
>
> rerun all the testbed and james: it should work:
>
> hope it helps,
> d.
>
>
>
>
> -----Messaggio originale-----
> Da: Raghavender Rao [mailto:sraghav_rao@hotmail.com]
> Inviato: giovedì 24 gennaio 2002 6.25
> A: drizzi@largesys.it
> Oggetto: PLease Help Me!!!
>
>
> hi ther,
>
>      I am trying to install JAMES with users repositories stored in
> Oracle.Connection eshtablished successfully.But when i try to adduser or
> listusers it gives me following Exception..
>
> --------------------------------------------
>
> 2002.01.24 10:13:34 086 Channel default opened
> loading broker properties from file:/var/maildatabase
> com.workingdogs.town.DataSetException: Error retrieving primary keys from
> table
> jamesusers: Unable to retrieve primary keys on table jamesusers
>         at
> com.workingdogs.town.ConnDefinition.getSchema(ConnDefinition.java:227
> )
>         at com.workingdogs.town.TableDataSet.<init>(TableDataSet.java:299)
>         at com.workingdogs.town.TableDataSet.<init>(TableDataSet.java:280)
>         at
> org.apache.james.userrepository.UsersTownRepository.countUsers(UsersT
> ownRepository.java:171)
>         at
> org.apache.james.remotemanager.RemoteManager.parseCommand(RemoteManag
> er.java:195)
>         at
> org.apache.james.remotemanager.RemoteManager.parseRequest(RemoteManag
> er.java:117)
>         at
> org.apache.avalon.blocks.serversocket.ServerSocketAcceptor.run(Server
> SocketAcceptor.java:77)
>         at
> org.apache.avalon.utils.recycle.pool.Worker.run(Worker.java:113)
>
> -----------------------------
>
> table has primary keys but still error.
>
> still to add
>
>  in com.workingdogs.town.ConnDefinition class and method getSchema();
>
> ------------------------------------------------------
> 1.           KeyDef keydef = new KeyDef();
> 2.            try
> 3.            {
> 4.                Connection connection1 = getConnection();
> 5.                try
> 6.                {
> 7.                    DatabaseMetaData databasemetadata =
> connection1.getMetaData();
> 8.                    ResultSet resultset1;
> 9.                    for(resultset1 =
> databasemetadata.getPrimaryKeys(connection1.getCatalog(), null, s);
> resultset1.next(); keydef.addAttrib(resultset1.getString("COLUMN_NAME")));
> 10.                   resultset1.close();
> 11.                   if(keydef.size() == 0)      // this is the cause of
> the error.....
> 12.                       throw new DataSetException("Unable to retrieve
> primary keys on table " + s);
> 13.                   schema.setDefaultKeyDef(keydef);
> 14.                   schemas.put(s, schema);
> 15.               }
> 16.               catch(Exception exception2)
> 17.               {
> 18.                   throw new DataSetException("Error retrieving primary
> keys from table " + s + ": " + exception2.getMessage());
> 19.               }
> 20.               releaseConnection(connection1);
> 21.            }
> 22.           catch(Exception exception1)
> 23.           {
> 24.               if(exception1 instanceof DataSetException)
> 25.                   throw (DataSetException)exception1;
> 26.               else
> 27.                   throw new DataSetException("Error retrieving schema
> info for table " + s + ": " + exception1.getMessage());
> 28.           }
> 29.       }
> -----------------------------------------------------
>
>  Line 11 is causing ERROR!!! the size of keydef is 0
>  and i wrote a small program to test this....
> -----------------------------------------------------
>      try {
>             java.sql.DriverManager.registerDriver(new
> oracle.jdbc.driver.OracleDriver());
>             int i=0;
>             java.lang.String s = "jamesusers";
>             java.sql.Connection connection =
> java.sql.DriverManager.getConnection("mydatabaseurl","username","p
> assword");
>             java.sql.Statement statement = connection.createStatement();
>             java.sql.DatabaseMetaData databasemetadata =
> connection.getMetaData();
>             java.sql.ResultSet resultset;
>             resultset =
> databasemetadata.getPrimaryKeys(connection.getCatalog(),null,s);
>             java.lang.System.out.println("The Value of ResultSet is
> "+resultset.next());
>
>             /*while(resultset.next()){
>
>                java.lang.System.out.println("The coloums are
> "+resultset.getString("COLUMN_NAME"));
>
>             }*/
>         }catch(java.lang.Exception exception){
>
>             exception.printStackTrace();
>         }
> -----------------------------------------------------
>
> The output of this program is :
>
>  The Value of ResultSet is false
>
> I tried with different tables which has primary keys but the output is
> same...
>
> Please help me to solve this problem as soon as possible.
>
> Rao
>
>
>
>
>
> ------------------------------------------------------------------
> ----------
> ----
> MSN Photos is the easiest way to share and print your photos: Click Here
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: PLease Help Me!!!

Posted by Danny Angus <da...@thought.co.uk>.
Thanks daniele,

Are you saying that all we have to do is make James use all uppercase for
tablenames?
If so have you tried v2 yet?

d.

> -----Original Message-----
> From: daniele rizzi [mailto:daniele.rizzi@www.largesys.it]
> Sent: Friday, January 25, 2002 8:22 AM
> To: James Users List
> Cc: sraghav_rao@hotmail.com
> Subject: I: PLease Help Me!!!
>
>
> I hope somebody put this in a faq or the like...
>
> Title: what happens when you implements a MailRepository under OracleDb
> Refers to: James 1.2.*, Oracle Server 9i (perhaps 8i and others)
>
> Subtitle: something went wrong, but I can't put my finger on it...
>
> Step to replicate:
> - first install james 1.2* and test everything is ok;
> - then create the schema (lets say JAMES) and  the table Message
> in the Db,
>   as sketched with mySql example;
> - then change the repository def (I forgot the steps at home, but
> cutting &
> pasting
>   the mySql defs basically works);
> - finally rerun james: even though evrytng is ok, deamon crashed
> in a weird
> way,
>   with the weirder exception:
> 2002.01.24 10:13:34 086 Channel default opened loading broker properties
> from file:/var/maildatabase com.workingdogs.town.DataSetException: Error
> retrieving primary keys from table
> jamesusers: Unable to retrieve primary keys on table jamesusers
>         at com.workingdogs.town.ConnDefinition.getSchema
>
> What happend?:
> James uses Town lib to serialize messages from / to db: Town
> knows there is
> a table called
> "Messages" to analyze before operating: the analysis looks for:
> - the type and name of columns;
> - the primary key(s);
> Introspection is done via getDatabaseMetaData(), but the Oracle
> implementation is faulty:
>
> IF you CREATE TABLE MESSAGE(), then the catalog contains an entry MESSAGE
> and getDatabaseMetaData() returns data as expected;
>
> IF you CREATE TABLE Message(), then the catalog contains an entry MESSAGE
> and getDatabaseMetaData() doesn't find the table and returns empty data;
>
> IF at this point you're rather confused and thinks there's
> something rotten,
> you should
> re-read the above sentences thrice and accept as a fact of life:
> according to Oracle Support this is *NOT* a bug, instead that's
> exactly the
> logical behaviour (and I'd known it better and not bugged people that
> works...).
>
> Finally the solution (by dany, which is me):
> you cannot change James and you cannot touch Town, and you
> cannot force Oracle to support logic, but you can:
>
> open sqlplus james/james@sid_your_db:
>
> CREATE TABLE MESSAGES(ETC);
>
> CREATE SYNONYM "Messages" FOR MESSAGES;
>
> SELECT * FROM CAT;
> -- you should see 2 entries: the first UPPERCASE, the second MixedCase;
>
> COMMIT; -- it always helps;
>
> exit sqlplus;
>
> rerun all the testbed and james: it should work:
>
> hope it helps,
> d.
>
>
>
>
> -----Messaggio originale-----
> Da: Raghavender Rao [mailto:sraghav_rao@hotmail.com]
> Inviato: giovedì 24 gennaio 2002 6.25
> A: drizzi@largesys.it
> Oggetto: PLease Help Me!!!
>
>
> hi ther,
>
>      I am trying to install JAMES with users repositories stored in
> Oracle.Connection eshtablished successfully.But when i try to adduser or
> listusers it gives me following Exception..
>
> --------------------------------------------
>
> 2002.01.24 10:13:34 086 Channel default opened
> loading broker properties from file:/var/maildatabase
> com.workingdogs.town.DataSetException: Error retrieving primary keys from
> table
> jamesusers: Unable to retrieve primary keys on table jamesusers
>         at
> com.workingdogs.town.ConnDefinition.getSchema(ConnDefinition.java:227
> )
>         at com.workingdogs.town.TableDataSet.<init>(TableDataSet.java:299)
>         at com.workingdogs.town.TableDataSet.<init>(TableDataSet.java:280)
>         at
> org.apache.james.userrepository.UsersTownRepository.countUsers(UsersT
> ownRepository.java:171)
>         at
> org.apache.james.remotemanager.RemoteManager.parseCommand(RemoteManag
> er.java:195)
>         at
> org.apache.james.remotemanager.RemoteManager.parseRequest(RemoteManag
> er.java:117)
>         at
> org.apache.avalon.blocks.serversocket.ServerSocketAcceptor.run(Server
> SocketAcceptor.java:77)
>         at
> org.apache.avalon.utils.recycle.pool.Worker.run(Worker.java:113)
>
> -----------------------------
>
> table has primary keys but still error.
>
> still to add
>
>  in com.workingdogs.town.ConnDefinition class and method getSchema();
>
> ------------------------------------------------------
> 1.           KeyDef keydef = new KeyDef();
> 2.            try
> 3.            {
> 4.                Connection connection1 = getConnection();
> 5.                try
> 6.                {
> 7.                    DatabaseMetaData databasemetadata =
> connection1.getMetaData();
> 8.                    ResultSet resultset1;
> 9.                    for(resultset1 =
> databasemetadata.getPrimaryKeys(connection1.getCatalog(), null, s);
> resultset1.next(); keydef.addAttrib(resultset1.getString("COLUMN_NAME")));
> 10.                   resultset1.close();
> 11.                   if(keydef.size() == 0)      // this is the cause of
> the error.....
> 12.                       throw new DataSetException("Unable to retrieve
> primary keys on table " + s);
> 13.                   schema.setDefaultKeyDef(keydef);
> 14.                   schemas.put(s, schema);
> 15.               }
> 16.               catch(Exception exception2)
> 17.               {
> 18.                   throw new DataSetException("Error retrieving primary
> keys from table " + s + ": " + exception2.getMessage());
> 19.               }
> 20.               releaseConnection(connection1);
> 21.            }
> 22.           catch(Exception exception1)
> 23.           {
> 24.               if(exception1 instanceof DataSetException)
> 25.                   throw (DataSetException)exception1;
> 26.               else
> 27.                   throw new DataSetException("Error retrieving schema
> info for table " + s + ": " + exception1.getMessage());
> 28.           }
> 29.       }
> -----------------------------------------------------
>
>  Line 11 is causing ERROR!!! the size of keydef is 0
>  and i wrote a small program to test this....
> -----------------------------------------------------
>      try {
>             java.sql.DriverManager.registerDriver(new
> oracle.jdbc.driver.OracleDriver());
>             int i=0;
>             java.lang.String s = "jamesusers";
>             java.sql.Connection connection =
> java.sql.DriverManager.getConnection("mydatabaseurl","username","p
> assword");
>             java.sql.Statement statement = connection.createStatement();
>             java.sql.DatabaseMetaData databasemetadata =
> connection.getMetaData();
>             java.sql.ResultSet resultset;
>             resultset =
> databasemetadata.getPrimaryKeys(connection.getCatalog(),null,s);
>             java.lang.System.out.println("The Value of ResultSet is
> "+resultset.next());
>
>             /*while(resultset.next()){
>
>                java.lang.System.out.println("The coloums are
> "+resultset.getString("COLUMN_NAME"));
>
>             }*/
>         }catch(java.lang.Exception exception){
>
>             exception.printStackTrace();
>         }
> -----------------------------------------------------
>
> The output of this program is :
>
>  The Value of ResultSet is false
>
> I tried with different tables which has primary keys but the output is
> same...
>
> Please help me to solve this problem as soon as possible.
>
> Rao
>
>
>
>
>
> ------------------------------------------------------------------
> ----------
> ----
> MSN Photos is the easiest way to share and print your photos: Click Here
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>