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 se...@free.fr on 2006/03/10 10:57:09 UTC

Oracle 9 and timestamp datatype

I'm using DdlUtils to analyze an Oracle 9i database structure using the
following code :

public void analyzeDb(ReferenceDatabase refDb){
...
    OracleDataSource dataSource = new OracleDataSource();
    dataSource.setURL("jdbc:oracle:thin:@" +
                    refDb.getHostName() +
                    ":" + refDb.getPort() +
                    ":" + refDb.getSessionId());
    dataSource.setUser(refDb.getUsername());
    dataSource.setPassword(refDb.getPassword());
    log.info("Connecting to " + dataSource.getURL() + "...");
    Platform platform = PlatformFactory.createNewPlatformInstance("Oracle9");
    platform.setDataSource(dataSource);
    log.info("Building database model...");
    Database database = platform.readModelFromDatabase(null, null,
        refDb.getUsername(), null);
...
}

In the resulting Database object, Columns that have a TIMESTAMP datatype are
assigned the OTHER jdbc datatype, despite the fact that the platform is created
with platform name specification. Is it a known bug ?

Re: Oracle 9 and timestamp datatype

Posted by Sebastien Arbogast <se...@gmail.com>.
> This direction is largely dependent upon the capabilities of the JDBC
> driver. First of all, you should make sure that you're using the
> newest driver that works with your DB. Since you're using Oracle 9, I
> suggest that you update to the 10g driver if you're not already using
> it.

I'll try to see with the new driver to see if it changes anything.

> Then for Oracle, the JDBC type that the JDBC driver returns, often
> depends on the native definition. E.g. if the TIMESTAMP in the
> database uses a size specifier (e.g. TIMESTAMP(9) ), then the JDBC
> driver cannot cope with it and returns OTHER. Unfortunately, there is
> currently not much that DdlUtils can do about this.

Right, but in my ddl script, the column type is well TIMESTAMP only,
without any size specifier, so the problem shouldn't come from here.

--
Sébastien Arbogast

Blog : http://www.sebastien-arbogast.com
The Epseelon Project : http://www.epseelon.org

Re: Oracle 9 and timestamp datatype

Posted by Thomas Dudziak <to...@gmail.com>.
On 3/10/06, sebastien.arbogast@free.fr <se...@free.fr> wrote:

> I'm using DdlUtils to analyze an Oracle 9i database structure using the
> following code :
>
> public void analyzeDb(ReferenceDatabase refDb){
> ...
>     OracleDataSource dataSource = new OracleDataSource();
>     dataSource.setURL("jdbc:oracle:thin:@" +
>                     refDb.getHostName() +
>                     ":" + refDb.getPort() +
>                     ":" + refDb.getSessionId());
>     dataSource.setUser(refDb.getUsername());
>     dataSource.setPassword(refDb.getPassword());
>     log.info("Connecting to " + dataSource.getURL() + "...");
>     Platform platform = PlatformFactory.createNewPlatformInstance("Oracle9");
>     platform.setDataSource(dataSource);
>     log.info("Building database model...");
>     Database database = platform.readModelFromDatabase(null, null,
>         refDb.getUsername(), null);
> ...
> }
>
> In the resulting Database object, Columns that have a TIMESTAMP datatype are
> assigned the OTHER jdbc datatype, despite the fact that the platform is created
> with platform name specification. Is it a known bug ?

This direction is largely dependent upon the capabilities of the JDBC
driver. First of all, you should make sure that you're using the
newest driver that works with your DB. Since you're using Oracle 9, I
suggest that you update to the 10g driver if you're not already using
it.
Then for Oracle, the JDBC type that the JDBC driver returns, often
depends on the native definition. E.g. if the TIMESTAMP in the
database uses a size specifier (e.g. TIMESTAMP(9) ), then the JDBC
driver cannot cope with it and returns OTHER. Unfortunately, there is
currently not much that DdlUtils can do about this.

cheers,
Tom