Sure. See below: I think in my case there's a conflict because my
table is called USERS.
The test below comes from my junit. You just need to point to a new
blank local db.
You'll note that my table does not contain an 'ADMIN' field but the
output logs that this column exists.
The work around I found was to use this:
            ResultSet rs = dmd.getColumns(null,"PUBLIC,"USERS",null);
instead of this:
            ResultSet rs = dmd.getColumns(null,null,"USERS",null);

But I'm not sure using "PUBLIC" is compatible with other databases. Is
it?  TIA


    public void testCreateUsers() {
        try {

            // jdbc:h2:~/test
            StringBuilder sb = new StringBuilder();

            sb.append("CREATE TABLE USERS (")
                    .append("ID IDENTITY PRIMARY KEY, ")
                    .append("Username varchar(10), ")
                    .append("Password varchar(10), ")
                    .append("Name varchar(60), ")
                    .append("Email varchar(100), ")
                    .append("AllowVisibleEmail bit, ")
                    .append("TypeOfUser varchar(12) )");
            Statement st = con.createStatement();
            st.execute(sb.toString());

            DatabaseMetaData dmd = con.getMetaData();
            String[] types = {"TABLE"};
            ResultSet rs = dmd.getColumns(null,null,"USERS",null);
            while (rs.next()) {
                StringBuilder xx = new StringBuilder();
                for (int j=1; j < rs.getMetaData().getColumnCount(); j+
+) {
                    xx.append(rs.getMetaData().getColumnName(j) + " =
" + rs.getObject(j)).append("\n");
                }
                log.info(xx.toString());
            }
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            fail(e.getMessage());
        }

    }

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