Hi, You need to make sure h2 jar file is in the classpath.
Regards Sylvain On Nov 22, 3:45 pm, Marc Chanliau <[email protected]> wrote: > I'm using a simple Java program to access my database: > > import java.sql.*; > public class H2JDBC1 { > public static void main(String[ ] a) throws Exception { > Class.forName("org.h2.Driver"); > Connection conn = > DriverManager.getConnection("jdbc:h2:~/documents/h2databases/dataservice_sample", > "marcc", "java1"); > conn.close(); > } > > } > > I get this error (can't find the driver, apparently): > > ~/documents/h2databases marcc$ java H2JDBC1 > Exception in thread "main" java.lang.ClassNotFoundException: org.h2.Driver > at java.net.URLClassLoader$1.run(URLClassLoader.java:202) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:190) > at java.lang.ClassLoader.loadClass(ClassLoader.java:307) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) > at java.lang.ClassLoader.loadClass(ClassLoader.java:248) > at java.lang.Class.forName0(Native Method) > at java.lang.Class.forName(Class.java:169) > at H2JDBC1.main(H2JDBC1.java:4) > > What am I missing? > > My database is called dataservice_sample and is located > in ~/documents/h2databases/ > My H2 install is located in /applications/h2/bin > I'm using a Mac (Snow Leopard) > > Thanks in advance, > Marc -- 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.
