
[[install-jdbc-driver-core]]
= Install JDBC Driver on Core
:description: Learn how to install a JDBC driver in OpenNMS {page-component-title} to detect, poll, or collect on JDBC services.

To detect, poll, or collect any JDBC service, you must install the appropriate JDBC driver.

. Download the JDBC driver JAR file from a repository, (for example, a public https://mvnrepository.com/[Maven repository]), or from the database vendor.
. Install the JAR file in `$\{OPENNMS_HOME}/lib/`.
. Restart {page-component-title}.

== Test an installed JDBC driver

.Connect to the Karaf shell
[source,console]
----
ssh -p 8101 admin@localhost
----

.Attempt an ad hoc collection using the database driver
[source, karaf]
----
collect org.opennms.netmgt.collectd.JdbcCollector 127.0.0.1 driver=org.mysql.jdbc.Driver collection=MySQL-Global-Stats-51 url=jdbc:mysql://OPENNMS_JDBC_HOSTNAME:3306/test
----

.If the JDBC driver is not available or the driver classname is incorrect, the collect command returns an error
[source, karaf]
----
Collect failed with: java.util.concurrent.ExecutionException: java.lang.RuntimeException: Unable to load driver class: java.lang.ClassNotFoundException: org.mariadb.jdbc.Driver
----
