[#| 2017-03-16T11:11:28.612 + 0200 |严重|的glassfish 4.1 | com.mrkcn.servlet.LoginServ 让| _ThreadID = 26; _ThreadName = HTTP监听-1(2); _ TimeMillis = 1489655488612; _level 值= 1000; | com.microsoft.sqlserver.jdbc.SQLServerException:' @ P2'附近的语法不正确。 在com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError (SQLServerException.java:216) 在com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServ erStatement.java:1515) 在com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePrep aredStatement(SQLServerPreparedStatement.java:404) 在com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement $ PrepStmtExecC md.doExecute(SQLServerPreparedStatement.java:350) 在com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696) 在com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLSe rverConnection.java:1715) 在com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLSer verStatement.java:180) 在com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLS erverStatement.java:155) 在com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery( SQLServerPreparedStatement.java:285) 在com.mrkcn.servlet.KonularServlet.doGet(KonularServlet.java:53) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:687) 在javax.servlet.http.HttpServlet.service(HttpServlet.java:790) 在org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java) :1682) 在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV) alve.java:318) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV) alve.java:160) 在org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.j AVA:734) 在org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav) 一:673) 在com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:99) 在org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j AVA:174) 在org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.j) AVA:416) 在org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav) 一:283) 在com.sun.enterprise.v3.services.impl.ContainerMapper $ HttpHandlerCallab le.call(ContainerMapper.java:459) 在com.sun.enterprise.v3.services.impl.ContainerMapper.service(Container Mapper.java:167) 在org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler。 Java的:206) 在org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.ja VA:180) 在org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpSer) verFilter.java:235) at org.glassfish.grizzly.filterchain.ExecutorResolver $ 9.execute(Executor Resolver.java:119) 在org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(De faultFilterChain.java:283) 在org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart (DefaultFilterChain.java:200) 在org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultF) ilterChain.java:132) 在org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultF) ilterChain.java:111) 在org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.jav 一:77) at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNI) OTransport.java:536) 在org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(摘要 actIOStrategy.java:112) 在org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerTh) readIOStrategy.java:117) 在org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access 100美元(Wo rkerThreadIOStrategy.java:56) 在org.glassfish.grizzly.strategies.WorkerThreadIOStrategy $ WorkerThreadR unnable.run(WorkerThreadIOStrategy.java:137) 在org.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.doWork(Abs tractThreadPool.java:591) 在org.glassfish.grizzly.threadpool.AbstractThreadPool $ Worker.run(Abstra) ctThreadPool.java:571) 在java.lang.Thread.run(Thread.java:745) |#]
我正在使用java netbeans网络服务。在den select命令期间,Mssql给出了错误。可能是什么问题?
另一个问题没有问题。我把问号放在错误的地方了吗?从sql管理中看到的sql没问题
String uye = req.getParameter("uye");
JSONObject j = new JSONObject();
ArrayList<String> konularList = new ArrayList<String>(100);
ConnectInfo connect = new ConnectInfo();
Connection con;
PreparedStatement pstmt;
ResultSet rs;
PrintWriter out = resp.getWriter();
con=connect.baglanti();
String Sorgu = "select t.id,t.uye,t.baslik,t.mesaj,t.kategori,format(t.tarih, 'dd.MM.yyyy HH:mm') as tarih,t.edittarih,t.aktif,t.indirimpuani,t.altkategori,t.link, isnull((select case when t.id = f.konuid and f.uye = ? then '1' else '0' end from takipkonu f where t.id = f.konuid and f.uye = ?),'0') as takip from konular t ?";
pstmt=con.prepareStatement(Sorgu);
pstmt.setString(1,uye);
pstmt.setString(2,uye);
pstmt.setString(3,"order by t.tarih");
rs=pstmt.executeQuery();
while(rs.next())
{
j.put("id", rs.getInt("id"));
j.put("uye",rs.getString("uye"));
j.put("baslik", rs.getString("baslik"));
j.put("mesaj", rs.getString("mesaj"));
j.put("kategori", rs.getString("kategori"));
j.put("altkategori", rs.getString("altkategori"));
j.put("tarih", rs.getString("tarih"));
j.put("edittarih", rs.getString("edittarih"));
j.put("aktif", rs.getInt("aktif"));
j.put("indirimpuani", rs.getInt("indirimpuani"));
j.put("link", rs.getString("link"));
j.put("takip", rs.getString("takip"));
konularList.add(j.toString());
}