Hi, It looks like you are using an old version of H2. It should work with a recent version. Could you post the *complete* error message (including error codes) and the complete stack trace?
Regards, Thomas On Wed, Jun 6, 2012 at 7:25 PM, michael.nitschke <[email protected]> wrote: > Hi, > yes, i did. > It results in an > Caused by: java.net.MalformedURLException: unknown protocol: classpath > at java.net.URL.<init>(Unknown Source) > at java.net.URL.<init>(Unknown Source) > at java.net.URL.<init>(Unknown Source) > at > org.h2.store.fs.FileSystemDisk.openFileInputStream(FileSystemDisk.java: > 396) > > Exception, no matter if the filepath is absolut or relative. > i tried it with file: and without any kind of protocol where i do not > get a problem with the protocol, but the file is not found. see below: > Caused by: java.io.FileNotFoundException: \create.sql (Das System kann > die angegebene Datei nicht finden) > at java.io.FileInputStream.open(Native Method) > at java.io.FileInputStream.<init>(Unknown Source) > at java.io.FileInputStream.<init>(Unknown Source) > at sun.net.www.protocol.file.FileURLConnection.connect(Unknown > Source) > at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown > Source) > at java.net.URL.openStream(Unknown Source) > at > org.h2.store.fs.FileSystemDisk.openFileInputStream(FileSystemDisk.java: > 397) > > > > Regards, > Mike > > On 5 Jun., 20:08, Thomas Mueller <[email protected]> wrote: >> Hi, >> >> Did you try using an absolute path, as in ...;INIT=runscript from >> 'classpath:/com/acme/create.sql' ? >> >> Regards, >> Thomas >> >> >> >> >> >> >> >> On Sunday, June 3, 2012, michael.nitschke wrote: >> > Hi knut, >> > Thanks for your answer, this seems a good solution. But in my case the >> > configuration is done in an xml file. >> > So as far as i know i cannot add java code into this file. >> >> > Thanks >> > Mike >> >> > On 1 Jun., 14:43, Knut Wannheden <[email protected]> wrote: >> > > Hi Michael >> >> > > This is what worked for me: >> >> > > String SCHEMA = "com/foo/product/default-schema.sql"; >> > > CallableStatement initCall = connection.prepareCall("RUNSCRIPT FROM '" >> > > + MyClass.class.getClassLoader().getResource(SCHEMA).toString() + >> > > "'"); >> > > initCall.execute(); >> >> > > This allows me to have the schema inside the same Jar file as the >> > > MyClass class (which happens to be the class I run this piece of code >> > > in). >> >> > > Hope that helps >> >> > > --knut >> >> > > On Thu, May 31, 2012 at 2:16 PM, michael.nitschke <[email protected]> >> > wrote: >> > > > So i did some more experiments. >> > > > I tried to run it with classpath: without the quotes around it,.. even >> > > > worse. >> > > > I tried with out classpath and without the quotes around it, ... same >> > > > result as above. >> > > > It tried it with various levels of paths in quotes, but it allways >> > > > results in an FileNotFoundException. >> >> > > > Maybe i missed some thing, can any body point me in any direction? >> > > > Thanx. >> > > > Mike >> >> > > > -- >> > > > 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 athttp:// >> > groups.google.com/group/h2-database?hl=en. >> >> > -- >> > 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. > > -- > 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. > -- 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.
