JavaMelody monitoring SQL
Searching for a lot of information on the Internet, only two posts in the open-source community are helpful, but there are still many problems with monitoring SQL. Many netizens have encountered the same problems as me, when the monitoring page is opened, the data cannot be monitored. The SQL column is 0 or NaN in any case. This problem is because the data source is not correctly configured. Here we will introduce two configuration methods. First, directly configure the data source and add an additional jdbc driver. According to the document in UserGuide, you can use Jndi to configure the data source. For example, if Hibernate is used. cfg. <property name = "hibernate. connection. driver_class "> net. bull. javamelody. jdbcDriver </property> <property name = "hibernate. connection. driver "> com. mysql. jdbc. driver </property> <property name = "hibernate. connection. url "> jdbc: mysql: // localhost: 3306/myschema </property> <property name =" hibernate. connection. Username "> myuser </property> <property name =" hibernate. connection. password "> mypassword </property> copy the code to pay attention to this location, which may be a common hibernate. cfg. the xml parameter is not like the configuration above. It doesn't matter. You only need to ensure that the original connection. driver is a real driver. Add the connection. driver_class parameter above to be the jdbc driver of javamelody. That is, refer to the following oracle hibernate data source file copy Code <? Xml version = "1.0" encoding = "GBK"?> <! -- Specify the DTD information of the Hibernate configuration file --> <! DOCTYPE hibernate-configuration PUBLIC "-// Hibernate/Hibernate Configuration DTD 3.0 // EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <! -- Hibernate-configuration is the root element connecting to the configuration file -->