Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / January 2006

Tip: Looking for answers? Try searching our database.

JDBC error "Table not found in Statement"

Thread view: 
mike - 24 Jan 2006 01:45 GMT
I am trying to use JDBC to connect to an OpenOffice Database (hsqldb).
When I try to run a query I get an error that says "Table not found in
Statement [Select * from MemberInfo].  MemberInfo being the table.  I
get the SQLException on a query, but I am not sure why.  As far as I
know, my code is all correct.  I have never done database connections,
so I am not really sure how to check if the Connection object is
actually hooked to the database.  It doesn't throw any exceptions
though, until I try to run the query.  When I make the connection I am
doing

conn =
DriverManager.getConnection("jdbc:hsqldb:/home/username/project/whatever.odb","sa","");

then I have this
ResultSet rs = conn.createStatement().executeQuery("SELECT * from
MemberInfo);

Any ideas?

ps) if needed I can post more code.  

Mike
IchBin - 24 Jan 2006 02:33 GMT
> I am trying to use JDBC to connect to an OpenOffice Database (hsqldb).
> When I try to run a query I get an error that says "Table not found in
[quoted text clipped - 18 lines]
>
> Mike

try this..

DriverManager.getConnection("jdbc:hsqldb:file:/home/username/project/whatever.odb","sa","");

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

IchBin - 24 Jan 2006 02:42 GMT
>> I am trying to use JDBC to connect to an OpenOffice Database (hsqldb).
>> When I try to run a query I get an error that says "Table not found in
[quoted text clipped - 22 lines]
>
> DriverManager.getConnection("jdbc:hsqldb:file:/home/username/project/whatever.odb","sa","");

Just to iterate..
[just add the database name at the end and not both the name.extension]

DriverManager.getConnection("jdbc:hsqldb:file:/home/username/project/DatabaseNameOnly","sa","");

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)

mike - 24 Jan 2006 04:02 GMT
Nope, same problem.  I made the above changes:
conn =
DriverManager.getConnection("jdbc:hsqldb:file:/home/user/project/DBName","sa","");

I do get in the "/home/user/project" directory  DBName.log,
DBName.properties, and DBName.script files.

The log file is now empty.  The first time I ran it, it had:
CREATE USER SA PASSWORD "" ADMIN
but then I ran it again, and it cleared it out.

The properties file looks fine.  The script file has the following:
CREATE SCHEMA PUBLIC AUTHORIZATION DBA
CREATE USER SA PASSWORD ""
GRANT DBA TO SA
SET WRITE_DELAY 20

I have searched on the internet and found others with the same problem,
but I am yet to find a solution.  

Thanks.
IchBin - 24 Jan 2006 09:36 GMT
> Nope, same problem.  I made the above changes:
> conn =
[quoted text clipped - 17 lines]
>
> Thanks.

Well if your script file only has that information than there is no
table defined in that DB. That tells me that it just wrote the defaults
as if it was creating a new database. It will do that if it can not find
the database defined in initial jdbc connection string. It will just
create a new one based on that connect statement, automatically. This
would make sense with the error you said you where getting before as
Table not found.

Questions:

- When you created you Database under OpenOffice did you create just the
DB or create it and then create tables in it. If it created this
database with OpenOffice then where is this database you are trying to
connect to? It can't be the one from your jdbc statement.

WHAT type of tables do you have defined in that DB? That is, MEMORY,
CACHED or file..

Have you tested just using the runManager or the runManagerSwing?

If you created your DB under Openoffice then you can not have the
OpenOffice database design fronted opened against that db. You will have
to run the db under a hsqldb server. This changes your connection string
completely.

Problems like this are usually very simple. It USUALLY GET CONFUSING
because HSQLDB will create a database even if it is not the one you
think your connecting to. Also having OpenOffice, in the mix, and not
knowing HSQLDB makes for more confusion.

The best way to go about this, until you get a handle on it is to:

-Copy your DB, you created in OpenOffice, to a different subdirectory.
- Use either runManager or runManagerSwing to test you connection string
by hand. Inset data.. blabblabblab
- Once working translate that information to your program.

Signature

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor,  Regular Guy (1952-)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.