You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by Ch...@kost.admin.ch on 2006/02/16 13:11:14 UTC

readModelFromDatabase(string) no javadoc entry with string parame ter

Hi,

I tried to read the model from a database using the platforms
readModelFromDatabase() method. This method seems to need a single string
parameter the meaning of which is unknown to me. Has anybody a suggestion
what kind of parameter it is? In javadoc I could not find this method with a
single string parameter.

Thank you

Christian

-------------------------------------- 
Christian Eugster
Koordinationsstelle für die dauerhafte Archivierung elektronischer
Unterlagen
c/o Schweizerisches Bundesarchiv
Archivstrasse 24      
3003 Bern

T/ 031 324 17 94
F/ 031 322 78 32
E/ christian.eugster@kost.admin.ch
W/ www.vsa-aas.org/Koordinationsstelle.78.0.html



-----Ursprüngliche Nachricht-----
Von: Thomas Dudziak [mailto:tomdzk@gmail.com]
Gesendet: Donnerstag, 16. Februar 2006 12:12
An: ddlutils-user@db.apache.org
Betreff: Re: Insert SQL error in PostgreSQL 8.1


On 2/16/06, Vignesh Swaminathan <vs...@cordys.com> wrote:

> I am trying to insert a row into a simple table like
>
> CREATE TABLE orders
> (
>   id int4 NOT NULL,
>   customerid int4,
>   orderdate timestamp,
>   shipdate timestamp,
>   CONSTRAINT orders_pkey PRIMARY KEY (id)
> )
>
> When I fire an insert using Platform.insert(Database, SQL) I get an
> exception message as follows. I tried printing the SQL using
> Platform.getInsertSQL which returned
>
> INSERT INTO "orders" ("id", "customerid", "orderdate", "shipdate")
> VALUES ('1000', '1000', '2006-03-16 00:00:00', '2006-04-21 00:00:00')
>
> However, when I fire this statement in the PostgreSQL query tool the
> insert goes ahead without problem. Please help.
>
<snip>

> Caused by: org.postgresql.util.PSQLException: ERROR: column "orderdate"
> is of type timestamp without time zone but expression is of type
> character varying

Looks like your database model has VARCHAR for the orderdate (and
possibly shipdate) column, and PostgreSql has no implicit default
conversion from string to timestamp. Is the model read from the
database or from an XML file ?

Tom

Re: readModelFromDatabase(string) no javadoc entry with string parame ter

Posted by Laurent Sacaut <ls...@8d.com>.
I started with readModelFromDatabase() and it got broken when I upgraded
ddlutils after Jan 1st.

I now use the method readFromDatabase(String) passing the platform name
as the string. It seems to be working fine with MySQL.


 public Database readDatabase(DataSource dataSource)
    {
        Platform platform =
PlatformFactory.createNewPlatformInstance(dataSource);
 
       return platform.readModelFromDatabase(platform.getName());
    }

Laurent


Thomas Dudziak wrote:

>On 2/16/06, Christian.Eugster@kost.admin.ch
><Ch...@kost.admin.ch> wrote:
>
>  
>
>>I tried to read the model from a database using the platforms
>>readModelFromDatabase() method. This method seems to need a single string
>>parameter the meaning of which is unknown to me. Has anybody a suggestion
>>what kind of parameter it is? In javadoc I could not find this method with a
>>single string parameter.
>>    
>>
>
>Yes, the site does not reflect the current source, but I really don't
>want to update the site every other day. You can generate the current
>Javadoc for yourself using
>
>ant javadoc
>
>To answer your question: the string parameter specifies the name of
>the read model. Usually, you'd use the name of the read database (e.g.
>for PostgreSQL, MySQL) or the schema name (for Oracle, Db2) for this.
>
>Tom
>
>  
>

Re: readModelFromDatabase(string) no javadoc entry with string parame ter

Posted by Thomas Dudziak <to...@gmail.com>.
On 2/16/06, Christian.Eugster@kost.admin.ch
<Ch...@kost.admin.ch> wrote:

> I tried to read the model from a database using the platforms
> readModelFromDatabase() method. This method seems to need a single string
> parameter the meaning of which is unknown to me. Has anybody a suggestion
> what kind of parameter it is? In javadoc I could not find this method with a
> single string parameter.

Yes, the site does not reflect the current source, but I really don't
want to update the site every other day. You can generate the current
Javadoc for yourself using

ant javadoc

To answer your question: the string parameter specifies the name of
the read model. Usually, you'd use the name of the read database (e.g.
for PostgreSQL, MySQL) or the schema name (for Oracle, Db2) for this.

Tom