嗨,我有一个名为 user_data 的表,其中包含 user_id、passwd 和 user_priv(weblogic 用户的角色)。我需要将我的数据库 user_data 与 weblogic 服务器映射。
我尝试使用包含此表的数据源创建一个带有 sqlAuthenticator 的提供程序。
我已经修改了所有查询以实现结果。
假设让用户从表中访问 weblogic 服务器:
<wls:sql-get-users-password>SELECT PASSWD FROM USER_DATA where user_id=?</wls:sql-get-users-password>
<wls:sql-user-exists>SELECT USER_ID FROM USER_DATA whre user_id=?</wls:sql-user-exists>
<wls:sql-list-users>SELECT USER_ID FROM USER_DATA whre user_id=?</wls:sql-list-users>
我将成功保存并再次重新启动应用程序服务器。
在重新启动服务器之前。我将在 user_data 表中添加数据以检查是否从表中获取天气。
我已插入数据并重新启动服务器,但无法在 weblogic 服务器中看到数据。
但是如果我尝试从 weblogic 服务器中删除数据,它会从 user_data 中删除数据,反之亦然。
我尝试的另一种方法是创建 readSqlAuthenticator 以使其仅可读。它将只有上面提到的 3 个语句。
但它会抛出异常
java.sql.SQLException: Invalid column index
at oracle.jdbc.driver.OraclePreparedStatement.setFormOfUseInternal(OraclePreparedStatement.java:16268)
at oracle.jdbc.driver.OraclePreparedStatement.setFormOfUseInternal(OraclePreparedStatement.java:16238)
at oracle.jdbc.driver.OraclePreparedStatement.setString(OraclePreparedStatement.java:7895)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setString(OraclePreparedStatementWrapper.java:314)
at weblogic.jdbc.wrapper.PreparedStatement.setString(PreparedStatement.java:914)
Truncated. see log file for complete stacktrace
>
<24 Jan, 2017 1:48:03 PM IST> <Error> <Security> <BEA-000000> <[Security:090759]A SQLException occurred while retrieving password information
java.sql.SQLException: Invalid column index
at oracle.jdbc.driver.OraclePreparedStatement.setFormOfUseInternal(OraclePreparedStatement.java:16268)
at oracle.jdbc.driver.OraclePreparedStatement.setFormOfUseInternal(OraclePreparedStatement.java:16238)
at oracle.jdbc.driver.OraclePreparedStatement.setString(OraclePreparedStatement.java:7895)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setString(OraclePreparedStatementWrapper.java:314)
at weblogic.jdbc.wrapper.PreparedStatement.setString(PreparedStatement.java:914)
Truncated. see log file for complete stacktrace
>
<24 Jan, 2017 1:48:03 PM IST> <Error> <Security> <BEA-000000> <[Security:090759]A SQLException occurred while retrieving password information
java.sql.SQLException: Invalid column index
at oracle.jdbc.driver.OraclePreparedStatement.setFormOfUseInternal(OraclePreparedStatement.java:16268)
at oracle.jdbc.driver.OraclePreparedStatement.setFormOfUseInternal(OraclePreparedStatement.java:16238)
at oracle.jdbc.driver.OraclePreparedStatement.setString(OraclePreparedStatement.java:7895)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setString(OraclePreparedStatementWrapper.java:314)
at weblogic.jdbc.wrapper.PreparedStatement.setString(PreparedStatement.java:914)
Truncated. see log file for complete stacktrace
>
<24 Jan, 2017 1:48:03 PM IST> <Error> <Security> <BEA-000000> <[Security:090759]A SQLException occurred while retrieving password information
java.sql.SQLException: Invalid column index
at oracle.jdbc.driver.OraclePreparedStatement.setFormOfUseInternal(OraclePreparedStatement.java:16268)
at oracle.jdbc.driver.OraclePreparedStatement.setFormOfUseInternal(OraclePreparedStatement.java:16238)
at oracle.jdbc.driver.OraclePreparedStatement.setString(OraclePreparedStatement.java:7895)
at oracle.jdbc.driver.OraclePreparedStatementWrapper.setString(OraclePreparedStatementWrapper.java:314)
at weblogic.jdbc.wrapper.PreparedStatement.setString(PreparedStatement.java:914)
Truncated. see log file for complete stacktrace
在启动应用程序服务器并单击用户和组时,我会得到以下异常
weblogic. security.providers.authentication.DBMSSQLAuthenticatorDelegateException: [Security:090279]Error listing users *
为此,我收到了删除过滤器的建议,例如:
<wls:sql-get-users-password>SELECT PASSWD FROM USER_DATA</wls:sql-get-users-password>
<wls:sql-user-exists>SELECT USER_ID FROM USER_DATA</wls:sql-user-exists>
<wls:sql-list-users>SELECT USER_ID FROM USER_DATA</wls:sql-list-users>
但这也没有用。是否有任何其他方法可以将我的数据库映射到 weblogic 服务器以获取所有用户 ID、密码和角色。
请就此向我提出建议。