Thursday, November 10, 2016

JMeter connect with Database -- JDBC Connection

  • if you met this issue like this:
jmeter.protocol.jdbc.config.DataSourceElement: Could not load driver: oracle.jdbc.OracleDriver java.lang.ClassNotFoundException: oracle.jdbc.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)

That means you miss the jdbc jar file.  you need to download teh Oracle JDBC driver file and put it into the Jmeter lib\ext dir.


 
  •  If you meet this issue:
java.sql.SQLException: Cannot create PoolableConnectionFactory (ORA-00923: FROM keyword not found where expected 

 That means there is something wrong with the  JDBC Connection Configuration setting:

Validation Query :: A simple query used to determine if the database is still responding. This defaults to 'SELECT 1' which is suitable for many databases. However some may require a different query; for example Oracle requires something like 'SELECT 1 FROM DUAL'. Note this validation query is used on pool creation to validate it even if "Test While Idle" suggests query would only be used on idle connections. This is DBCP behaviour.