Witam.
Mam nastepujacy problem.
Po pomyslnym polaczeniu z baza, nie wiem w jaki sposob porownac login oraz haslo z formularza z loginem i haslem z bazy danych.
Moge dodawac oraz usuwac dane z bazy, na innej stronie.
oto kod programu:
try
{
Connection con = null;
con = DriverManager.getConnection("jdbc:odbc:test");
Statement statement = con.createStatement();
ResultSet rs=null;
rs.first();
String log = request.getParameter("log");
String has = request.getParameter("has");
statement.executeQuery("SELECT * FROM OSOBA WHERE LOGIN=log AND HASLO=has");
if(log.equals("log") || has.equals("has"))
{
out.println(log);
out.println(has);
}
}
catch (Exception e) {out.println("Exception: "+e.getMessage());}
%>
<br/>
<center>
<form action="<%=request.getRequestURI()%>" method="POST">
<input name="add" type="hidden" value="true"/>
<div>Login: <input name="log" type="text" value=""/></div>
<div>Haslo: <input name="has" type="text" value=""/></div>
<div><input type="submit" value="Zaloguj"/></div>
</form>
Problem w tym, ze po wpisaniu istniejacych danych, na stronie wywala mi wyjatek:
Exception: null
Czy ktos zna powod takowego komunikatu?
Za wszelakie wskazowki ogromne dzieki ;-)