Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Prüfen, ob Tabelle existiert
PostPosted: Fri May 20, 2005 5:28 pm 
Newbie

Joined: Sun May 08, 2005 6:43 pm
Posts: 4
Hi,

wie kann ich prüfen, ob eine bestimmte Tabelle in meiner Datenbank (ich benutze hsqldb) existiert?

habe es so versucht:

public boolean isTableExisting(String tablename){
try {
Class.forName("org.hsqldb.jdbcDriver");
Connection con = DriverManager.getConnection ("jdbc:hsqldb:nutritionCoachDB","sa","");
Statement stmt = con.createStatement();
DatabaseMetaData dmd = con.getMetaData();
ResultSet rs = dmd.getTables( null, null, tablename, null );
if(rs.next()){
return true;
}
} catch ( SQLException sqle ) {
sqle.printStackTrace();
} catch ( ClassNotFoundException cnfe ) {
cnfe.printStackTrace();
}
return false;
}

funktioniert leider nicht, er gibt mir immer false zurück, auch bei Tabellen, die es gibt...

Vielen Dank für HIlfe!


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 31, 2005 5:10 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
HSQL DB doku oder so schauen.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.