boa tarde, gostaria de saber o que significa o trecho de codigo abaixo pq eu nao entendi direito
if (! conn.isClosed() ) {
query = "select count(*) as total from tb_login where login = \""+request.getParameter("login")+"\" and senha=\""+request.getParameter("senha")+"\"";
ResultSet rs = conn.createStatement().executeQuery(query);
ate aki eu sei q esta contando o tamanho da tabela , eu ja tenho um login cadastrado la dentro so quero saber se tem mas de um la dentro como posso faser isso ??
try {
aki e q eu nao entendi
while(rs.next()){
if(rs.getString("total").equals("1")){
Statement st = conn.createStatement();
query = "insert into sessao values (null, \""+request.getParameter("login")+"\")";
int res = st.executeUpdate(query);
pois quando executo com ele da erro pq nao existe a tabela sessao no meu bd[e nao tem msmo], porem qndo eu tiro esse insert da esse erro
java.sql.SQLException: Can not issue SELECT via executeUpdate().
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1073)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1657)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1617)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:112)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:377)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)
grato pela atencao de todos