Hi,

Thanks a lot! I have now implemented a workaround for this problem. It
will be included in the next release (maybe tomorrow).

Regards,
Thomas


On Mon, Dec 29, 2008 at 3:35 AM, Pavel <[email protected]> wrote:
>
> I got the following error for linked table:
> Exception in thread "main" org.h2.jdbc.JdbcSQLException: Value too
> long for column DT: DATE '2008-01-08' [90005-105]
>        at org.h2.message.Message.getSQLException(Message.java:103)
>        at org.h2.message.Message.getSQLException(Message.java:114)
>        at org.h2.table.Column.validateConvertUpdateSequence(Column.java:301)
>        at org.h2.table.Table.validateConvertUpdateSequence(Table.java:579)
>        at org.h2.command.dml.Insert.update(Insert.java:119)
>        at org.h2.command.CommandContainer.update(CommandContainer.java:71)
>        at org.h2.command.Command.executeUpdate(Command.java:207)
>        at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:163)
>        at org.h2.mine.Test.datetime2date(Test.java:51)
>        at org.h2.mine.Test.main(Test.java:10)
>
> ==============================================
>
> The reason for this error is that Oracle and H2 have different
> precision for date/time values and the precision check fails within
> Column.java (line 296). The fix may be to  remove  precision checks
> for date/time types and for most numeric types (like REAL and DOUBLE).
> Precisions returns by different database are different and they are
> not important in this place.
>
>
> ========================================
>
> To reproduce the error:
> ========================================
>
> package org.h2.mine;
>
> import org.h2.test.TestBase;
>
> import java.sql.*;
>
> public class Test {
>
>    public static void main(String[] a) throws Exception {
>        new Test().datetime2date();
>    }
>
>
>    public void datetime2date() throws Exception {
>
>        String driver = "oracle.jdbc.driver.OracleDriver";
>        Class.forName(driver);
>        String url = "jdbc:oracle:thin:@127.0.0.1:1521:XE";
>        Connection oracle = DriverManager.getConnection(url, "scott",
> "tiger");
>
>        Statement ora = oracle.createStatement();
>        drop(ora, "TWO");
>        ora.execute("CREATE TABLE TWO (DT DATE)");
>
>        Class.forName("org.h2.Driver");
>
>        Connection h2 = DriverManager.getConnection
> ("jdbc:h2:mem:dual");
>        Statement sa = h2.createStatement();
>        drop(sa, "ONE");
>
>        sa.execute("CREATE TABLE ONE (DT DATE)");
>        sa.execute("INSERT INTO ONE VALUES (TIMESTAMP'2008-01-08
> 10:11:15')");
>
>        sa.execute("CREATE LINKED TABLE TWOL
> ('oracle.jdbc.driver.OracleDriver',
> 'jdbc:oracle:thin:@127.0.0.1:1521:XE', 'scott', 'tiger', 'TWO');");
>
>        sa.execute("INSERT INTO TWOL SELECT DT FROM ONE");
>        {
>            ResultSet rs = sa.executeQuery("select * FROM TWO");
>            rs.next();
>        }
>        drop(ora, "TWO");
>        drop(sa, "ONE");
>    }
>
>
>    private void drop(Statement sa, String name) {
>        try {
>            sa.execute("DROP TABLE " + name);
>        } catch (SQLException e) {
>        }
>    }
>
>
> }
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to