serverfejl eller kodefejl?
Mit spørgsmål er egentlig simpelt. Er følgende en server fejl eller kode fejl?500 Internal Server Error
java.sql.SQLException: SQL string is not Query
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:189)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:231)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:294)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2631)
at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:777)
at mypackage.DbConnection.executeQuery(DbConnection.java:55)
at _tilmeld._jspService(tilmeld.jsp:24)
[SRC:/tilmeld.jsp]
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:139)
at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:349)
at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:604)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
at java.lang.Thread.run(Thread.java:534)
koden ser er følgende
<%
DbConnection connection = new DbConnection();
connection = connection.hentInstans();
String fornavn = request.getParameter("fornavn");
String efternavn = request.getParameter("efternavn");
String sportsgren = request.getParameter("sportsgren");
String cprnummer = request.getParameter("cprnummer");
if (request.getParameter("fornavn").equalsIgnoreCase("") || request.getParameter("efternavn").equalsIgnoreCase("") || request.getParameter("cprnummer").equalsIgnoreCase("") )
{
out.println("<h1>Alle felter skal udfyldes!</h1>");
}else {
String query = "INSERT INTO Medlem (Medlemid, Sportsgrenid,Fornavn,Efternavn,Cprnr) VALUES (medlemidnr.NEXTVAL,"+sportsgren+",'"+fornavn+"', '"+efternavn+"', '"+cprnummer+"');";
System.out.println(query);
connection.executeQuery(query) ;
out.print(request.getParameter("fornavn") + "er hermed blevet indmeldt i klubben!" );
}
%>
som i kan se udskrives query'en og den virker fint hvis jeg indsætter sætningen direkte i databasen.