You may be able to skip the manual table pre-creation by using CREATE TABLE AS SELECT.
1.) Launch H2 ensuring the downloadable microsoft SQL Server JDBC driver jar is in your CLASSPATH 2.) in H2: CREATE LINKED TABLE LNK_TBLNAME( 'com.microsoft.sqlserver.jdbc.SQLServerDriver','jdbc:sqlserver:// sqlserverhostname','sqlusername','sqlpassword','SqlDatabaseName.dbo.SqlTableName') READONLY; 3.) in H2: CREATE TABLE TBLNAME AS SELECT * FROM LNK_TBLNAME; If you're using a sql named instance append \INSTANCENAME to the URL in the linked table stmt If you're using windows authentication to mssql, then there's more prep to do... a.) ensure the appropriate auth dll bundled with the msjdbc driver is acessible by H2 b.) append ;IntegratedSecurity=true to the linked table jdbc URL c.) use NULL without quotes for the sqlusername and sqlpassword arguments. If you want to use a query instead of a table or view as the source, just wrap it in parens and convert internal single quotes to two single quotes to escape them. This is my favorite feature of H2 by far. Good luck! -- 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.
