• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

drop database with PreparedStatement

 
yaron re
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any idead why the following code doesn't work:

con = dataSource.getConnection();
ps = con.prepareStatement("DROP DATABASE DBNAME ");
rs = ps.executeQuery();
 
Jan Cumps
Bartender
Posts: 2584
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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)
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why do you think that its appropriate here in performance?
 
yaron re
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The question remains the same. What are you getting? Any errors? Excpetions? Messages?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic