首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >MySQL或Tomcat日志查询

问MySQL或Tomcat日志查询
EN

Stack Overflow用户
提问于 2013-11-12 18:42:11
回答 2查看 1.3K关注 0票数 0

我遇到了一个特殊的查询问题,它在SQLYog中运行得很好,但在我的JSP页面中运行得不好。我在JSP页面中没有得到任何结果,也没有得到任何错误,但是如果我直接在数据库上运行相同的查询,我会得到预期的结果。

我希望能够看到试图发送到MySQL服务器的查询,然后希望我能找出可能出错的原因。这可以做到吗?

我使用的是MySQL Server5.5 for Windows64位,Tomcat7 for Windows64位,我的连接类如下:

代码语言:javascript
复制
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;
}

对启用日志记录的任何帮助都将不胜感激:-)

查询如下:

代码语言:javascript
复制
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
EN

回答 2

Stack Overflow用户

发布于 2013-11-12 18:47:01

您可以使用General Query Logging MySQL选项查看对MySQL服务器的所有查询。

票数 0
EN

Stack Overflow用户

发布于 2013-11-12 19:03:48

您确定在jsp页面中的查询已执行吗?你能把你的jsp页面的代码放进去吗?

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19926954

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档