Hi Thomas,

For the following test case I got the error:
The proposed fix is at the end of the E-mail

=========================
        at org.h2.message.Message.getSQLException(Message.java:103)
        at org.h2.message.Message.convert(Message.java:257)
        at org.h2.command.Command.executeUpdate(Command.java:225)
        at org.h2.jdbc.JdbcStatement.execute(JdbcStatement.java:163)
        at org.h2.samples.Test.mixedCase(Test.java:111)
        at org.h2.samples.Test.main(Test.java:15)
Caused by: java.lang.NullPointerException
        at org.h2.util.StringUtils.toLowerEnglish(StringUtils.java:64)
        at org.h2.table.TableLink.convertColumnName(TableLink.java:252)
        at org.h2.table.TableLink.readMetaData(TableLink.java:240)
        at org.h2.table.TableLink.connect(TableLink.java:82)
        at org.h2.table.TableLink.<init>(TableLink.java:65)
        at org.h2.schema.Schema.createTableLink(Schema.java:470)
        at org.h2.command.ddl.CreateLinkedTable.update(CreateLinkedTable.java:
78)
        at org.h2.command.CommandContainer.update(CommandContainer.java:69)
        at org.h2.command.Command.executeUpdate(Command.java:206)
        ... 3 more

==========================
    public static void mixedCase() throws Exception {

        Class.forName("net.sourceforge.jtds.jdbc.Driver");
        Class.forName("org.h2.Driver");

        Connection linked =
DriverManager.getConnection("jdbc:jtds:sqlserver://localhost:1433",
"myuser", "mypassword");

        Statement mssql = linked.createStatement();
        try {
            mssql.execute("DROP TABLE testtable");
        } catch (SQLException e) {
        }
        mssql.execute("CREATE TABLE testtable(lower INT, UPPER INT,
MiXeD INT)");

        Connection h2 = DriverManager.getConnection("jdbc:h2:mem:ms");

        Statement sb = h2.createStatement();
        sb.execute("CREATE LINKED TABLE
two('net.sourceforge.jtds.jdbc.Driver','jdbc:jtds:sqlserver://
localhost:1433','myuser','mypassword','testtable')");
        ResultSet rs = sb.executeQuery("SELECT * from  two");
        ResultSetMetaData md = rs.getMetaData();
/*
        Assert.assertEquals(md.getColumnName(1), "LOWER");
        Assert.assertEquals(md.getColumnName(2), "UPPER");
        Assert.assertEquals(md.getColumnName(3), "MIXED");
*/

        rs = sb.executeQuery("SELECT lower,upper,mixed from  two");

        rs = sb.executeQuery("SELECT LOWER,UPPER,MIXED from  two");

        linked.close();
        h2.close();


    }
================

The fix would be to add the following lines in TableLink.java line
220, to ignore some indexes returned by MS Sql Server

                if (rs.getShort("TYPE") ==
DatabaseMetaData.tableIndexStatistic) {
                    continue;
                }


--~--~---------~--~----~------------~-------~--~----~
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