aspose file tools*
The moose likes JDBC and the fly likes connecting java program to openoffice base Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "connecting java program to openoffice base" Watch "connecting java program to openoffice base" New topic
Author

connecting java program to openoffice base

Jitto P.Jose
Greenhorn

Joined: Sep 18, 2007
Posts: 27
i am using ubuntu feisty,
now am doing a small java program that connect to openoffice base.
the program i wrote is given below. while running i always got error as "java.sql.SQLException: Table not found in statement [select * from test]"
it didnt make any problem till the line of connection establishment. but at the time of executeQuery(), it produce exception
please help me if anybody know anything about this problem




the code is ..

import java.sql.*;


public class TestDb {

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println("hai");


try {
Class.forName("org.hsqldb.jdbcDriver");
}
catch(ClassNotFoundException e) {
System.out.println(e);
}

try {
Connection con=null;
try{
con=DriverManager.getConnection("jdbc:hsqldb:jitto db");
}catch(Exception e){
System.out.println(e.getMessage());
}
System.out.println(con.toString());
Statement st=con.createStatement();
System.out.println(st.toString());
String s="create table test (name varchar(20))";
//String s="insert into login values('jitto')";
ResultSet rs=st.executeQuery("select * from test");
//st.executeQuery(s);

st.close();
con.close();

}
catch(SQLException e){
System.out.println(e);
}


}

}





error found:--

"java.sql.SQLException: Table not found in statement [select * from test]"



thanks
jittos....


Get updated with the world http://hallowdemon.ismywebsite.com
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41853
    
  63
Do you know for sure whether that table exists?


Ping & DNS - my free Android networking tools app
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: connecting java program to openoffice base