Hello! How are you? I have a problem very weird! I explain. I have an application made with Java and Oracle among others. One of the things that the application does is create and delete other databases. For example if I want to create a new database called A1(actually, what I create is not exactly a database but it is not important, think that is a new entry in a table ok?) first of all I create a new user called like the database will be A1 in this case. It is all ok the problem comes when I want to delete that “database”. I drop it perfectly but an exception appears when I try to drop the user.
The code that I have to do that is:
ps=con.prepareStatement("drop user "+usuario+" cascade");
afectados = ps.executeUpdate();
the exception tells:
java.sql.SQLException: ORA-01940: no se puede borrar un usuario conectado actualmente( It’s imposible to drop an user who is connected now)
but look at this; If I want to delete the user A1 I connect to the database whit other user
(system is the user and alumno_system the password)
I have trayed another thing to make sure that the user is not connected, this:
ok and If I do that probably it tells me that the user connected is the user I want to drop (because it is the exception) but what I wan to get I that the user connected to disconnect do you understand me???
If I understand you ... You want issue a DROP USER command from the source code and it will drop the user that is currently connected... If that's
the case, you might put in the source code something like....
behind the scenes, re-logon as a priv. user. Issue the drop user command
then logoff the user... You can't drop a user account if that user is currently connected to the database.