PreparedStatementCallback;ungültige ResultSet-Zugriff für SQL[SQLStatememnt];verschachtelte Ausnahme ist java.sql.SQLException:Ungültiger Spaltenindex Frühjahr Auth
Ich arbeite mit einer Spring-Boot-Anwendung mit den Spring BootSecurtiy D. H., authentication manager-generator. Die Anmeldung sollte erfolgen, indem die Entitäten der Datenbank. Aber es zeigt folgende Fehlermeldung, wenn ich login.
PreparedStatementCallback; ungültige ResultSet-Zugriff für SQL [SELECT USER_LOGIN_ID, PASSWORT VON USER_ACCOUNT WO USER_LOGIN_ID=?]; nested exception is java.sql.SQLException: Ungültiger Spaltenindex
Edit 1:
Wie vorgeschlagen, ich habe die Abfrage:
WÄHLEN SIE USER_LOGIN_ID, PASSWORT, AKTIVIERT USER_ACCOUNT WO USER_LOGIN_ID=?
und
WÄHLEN SIE USER_LOGIN_ID, PASSWORT, ACTIVE AUS USER_ACCOUNT WO USER_LOGIN_ID=?
Ich bekomme immer noch den Fehler wie
Grund: PreparedStatementCallback; schlechte SQL-Grammatik [WÄHLEN Sie USER_LOGIN_ID, PASSWORT, AKTIVIERT USER_ACCOUNT WO USER_LOGIN_ID=?]; nested exception is java.sql.SQLSyntaxErrorException: ORA-00904: "AKTIVIERT": Ungültiger Bezeichner
Meine Sicherheit Config-Klasse
package io.trial;
import javax.sql.DataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled=true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
public void globalConfig(AuthenticationManagerBuilder auth, DataSource dataSource) throws Exception{
/*auth.jdbcAuthentication()
.dataSource(dataSource)
.authoritiesByUsernameQuery("select p.user as principal, p.password as credentials, true from Provider p where p.user= ?");*/
//System.out.println(dataSource);
auth.jdbcAuthentication().dataSource(dataSource)
.usersByUsernameQuery("SELECT USER_LOGIN_ID, PASSWORD FROM USER_ACCOUNT WHERE USER_LOGIN_ID=?")
.authoritiesByUsernameQuery("SELECT USER_LOGIN_ID , PASSWORD FROM USER_ACCOUNT WHERE USER_LOGIN_ID=?");
}
}
- Möglich, Duplikat der Spring Security: Konfiguration(AuthenticationManagerBuilder auth)
Du musst angemeldet sein, um einen Kommentar abzugeben.
Es versuchen, Lesen Sie die Spalte index nicht vorhanden Ursache dieser Ausnahme. Das Datenmodell unterstützt die aktiv - /inaktiv der Benutzer als zusätzliche Spalte. Also, die Abfrage sollte sein:
Sehe ich keine andere Ausgabe.
Dank Nisse Engström. Ändern Sie die Abfrage, um
gelöst.