Java Reference
In-Depth Information
Only database super users and administrators can use the DROP GROUP command. This command
deletes a group, not the users:
DROP GROUP group_name
The users are simply left as they are, without any group assignments. You can always add these users
to another group you create.
The JDBC code to create and delete a group is shown in Listing 24-1 .
Listing 24-1: Working with groups
package jdbc_bible.part2;
import java.sql.*;
import sun.jdbc.odbc.JdbcOdbcDriver;
public class GroupMaker {
static String jdbcDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
static String groupName = "";
static String url = "jdbc:odbc:dummyDB";
static String SQL_GroupCreate =
"CREATE GROUP ";
static String SQL_GroupDelete =
"DROP GROUP ";
public GroupMaker (){
registerDriver();
}
public void setGroupName(String groupName){
this.groupName = groupName;
}
public void registerDriver() {
try
{
Class.forName(jdbcDriver);
DriverManager.registerDriver(new JdbcOdbcDriver());
}
catch(ClassNotFoundException e){
System.err.print(e.getMessage());
Search WWH ::




Custom Search