The moose likes JDBC and the fly likes drop database with PreparedStatement  Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "drop database with PreparedStatement  " Watch "drop database with PreparedStatement  " New topic
Author

drop database with PreparedStatement

yaron re
Greenhorn

Joined: Jun 29, 2007
Posts: 7
any idead why the following code doesn't work:

con = dataSource.getConnection();
ps = con.prepareStatement("DROP DATABASE DBNAME ");
rs = ps.executeQuery();
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2343

Maybe because your code has an active connection to the database?
What happens when you execute the code? (better not try this on your production instance)


OCUP UML fundamental
ITIL foundation
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Why do you think that its appropriate here in performance?
yaron re
Greenhorn

Joined: Jun 29, 2007
Posts: 7
the dataSource is in a superior level to the instance that i am tring to delete.
The connection must have the ability to delete the DB.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
The question remains the same. What are you getting? Any errors? Excpetions? Messages?
 
I agree. Here's the link: http://jrebel.com/download
 
subject: drop database with PreparedStatement
 
Similar Threads
How to prevent a user from dropping tables
Clean database
Game on SQL
WA #1.....word association
Restore problem