Обсуждение: JDBC support for DROP USER?

Поиск
Список
Период
Сортировка

JDBC support for DROP USER?

От
Dnesbitt@encryptix.com
Дата:
Good People,

We are getting an exception when trying to drop a user with a JDBC
PreparedStatement.  Is this supported?  Here is the response we are seeing:
  java TestPrepare  error : ERROR: parser: parse error at or near "'" 

Thanks in advance for any insight.  The sample source code follows.

Best Regards,
//Dave


import java.sql.*;

public class TestPrepare {
  public static void main(String[] args) {     try {        Class.forName("org.postgresql.Driver");     } catch
(Exceptione) {        System.out.println("load driver fails");        return;     }     try {        Connection con =
 
DriverManager.getConnection("jdbc:postgresql://<host>/<db>",
"<user>",
"<password>");        String dropUserSQL = "drop user ?";        PreparedStatement dropUserPs =
con.prepareStatement(dropUserSQL);
        String userName = "tester";        dropUserPs.setString(1, userName);
        dropUserPs.executeUpdate();     } catch (SQLException e) {        System.out.println("error : " +
e.getMessage());       return;     }  }
 
}