我遇到了一个特殊的查询问题,它在SQLYog中运行得很好,但在我的JSP页面中运行得不好。我在JSP页面中没有得到任何结果,也没有得到任何错误,但是如果我直接在数据库上运行相同的查询,我会得到预期的结果。
我希望能够看到试图发送到MySQL服务器的查询,然后希望我能找出可能出错的原因。这可以做到吗?
我使用的是MySQL Server5.5 for Windows64位,Tomcat7 for Windows64位,我的连接类如下:
public static Connection getConnection()
{
settings settings1 = new settings();
Connection connection = null;
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection("jdbc:mysql://" + dbHost + "/" + settings1.db + "?useUnicode=true&characterEncoding=UTF-8", settings1.dbUsername, settings1.dbPassword);
}
catch(Exception exception)
{
exception.printStackTrace();
}
return connection;
}对启用日志记录的任何帮助都将不胜感激:-)
查询如下:
SELECT product.ID, product.partCodePS, product.partCodeManufacturer, product.pName, product.priceCost, product.priceSell, product.reorderLevel, product.location, brand.leadTime, SUM(order_product.unitPrice)
FROM product
INNER JOIN order_product ON (product.ID = order_product.productID)
INNER JOIN brand ON (product.brandID = brand.ID)
INNER JOIN order ON (order_product.orderID = order.ID)
WHERE (product.isWebsite =1 AND order.o_statusID IN (1,2,3,4,5,11,12,14,15))
GROUP BY order_product.unitPrice发布于 2013-11-12 18:47:01
您可以使用General Query Logging MySQL选项查看对MySQL服务器的所有查询。
发布于 2013-11-12 19:03:48
您确定在jsp页面中的查询已执行吗?你能把你的jsp页面的代码放进去吗?
https://stackoverflow.com/questions/19926954
复制相似问题