Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

connecting java program to openoffice base

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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....
 
Rancher
Posts: 43015
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know for sure whether that table exists?
 
This tiny ad is wafer thin:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic