![](/img/trans.png)
[英]PreparedStatement IF EXISTS throws: org.postgresql.util.PSQLException: The column index is out of range: 1, number of columns: 0
[英]org.postgresql.util.PSQLException: The column index is out of range: 3, number of columns: 2
我決定通過在其中添加使用spring security
和數據庫的身份驗證來修改我的應用程序。 在我對XML中的user
和password
使用普通身份驗證之前。 工作正常。
我的authentication-manager
如下所示
<authentication-manager>
<authentication-provider>
<jdbc-user-service data-source-ref="dataSource"
users-by-username-query="select username, password from pmc.username_password where username=?;"
authorities-by-username-query="select a.username, b.role from pmc.username_password a, pmc.username_role b where a.username = b.username and a.username=?;" />
</authentication-provider>
</authentication-manager>
但是當我嘗試進行身份驗證時,我遇到了異常
org.springframework.security.authentication.InternalAuthenticationServiceException: PreparedStatementCallback; SQL [select u
sername, password from pmc.username_password where username=?;]; The column index is out of range: 3, number of columns: 2.;
nested exception is org.postgresql.util.PSQLException: The column index is out of range: 3, number of columns: 2.
XML文件中的sql
語法有什么問題?
Spring Security希望用戶查詢按順序列出三列:
你沒有最后一個。 如果您的數據庫中沒有等效於“啟用”的屬性,則可以使用TRUE
常量。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.