how can i connect an open office database in java?
open office database in java
Collapse
X
-
Tags: None
-
i'm using ubuntu.. with open office database..
import java.sql.*;
public class DB {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
Class.forName(" org.hsqldb.jdbc Driver");
Connection mycon=DriverMan ager.getConnect ion("jdbc:hsqld b:file://home//workspace//Database//db","sa","");
Statement Que=mycon.creat eStatement();
ResultSet result=Que.exec uteQuery("SELEC T * FROM Table1");
}
im having an exception
Exception in thread "main" java.lang.Class NotFoundExcepti on: org.hsqldb.jdbc Driver
at java.net.URLCla ssLoader$1.run( URLClassLoader. java:200)
at java.security.A ccessController .doPrivileged(N ative Method)
at java.net.URLCla ssLoader.findCl ass(URLClassLoa der.java:188)
at java.lang.Class Loader.loadClas s(ClassLoader.j ava:306)
at sun.misc.Launch er$AppClassLoad er.loadClass(La uncher.java:268 )
at java.lang.Class Loader.loadClas s(ClassLoader.j ava:251)
at java.lang.Class Loader.loadClas sInternal(Class Loader.java:319 )
at java.lang.Class .forName0(Nativ e Method)
at java.lang.Class .forName(Class. java:164)
at DB.main(DB.java :12)
maybe i did not include the hsqldb.jar
how can i include the file? im using eclipseComment
-
I'm sure you didn't include it; navigate to:Originally posted by Peter Timbolmaybe i did not include the hsqldb.jar
how can i include the file? im using eclipse
Project>Propert ies>Java Build Path>Libraries> Add External Jars ...
and add the hsqldb.jar file.
kind regards,
JosComment
-
its works.. thanks..
but i'm having Table not found in statement [SELECT ID FROM Assets]
i think i can figure this out..
thanks again..Comment
-
Is openOffice.org database has a different method in displaying filtered contents?
im having Table not found in java.. and in openoffice itself..
but in queries tab, it will work.. how can i do that in java?Comment
-
Perhaps you are passing an incorrect table name (case issues e.t.c).Originally posted by Peter TimbolIs openOffice.org database has a different method in displaying filtered contents?
im having Table not found in java.. and in openoffice itself..
but in queries tab, it will work.. how can i do that in java?Comment
-
O just misinterpret the jdbc...
it will create it's own database file if the file is not present..
So you need to create tables etc..
that was great.. thanks guys..Comment
Comment