Simply use the MySQL Driver to connect and access data just as you would access any traditional database. Open WILDFLY_HOME\standalone\configuration\standalone.xml, and then find tag, inside that tag, put these lines to add MySQL driver: The MySQL JDBC Driver offers the most natural way to access MySQL data from any Java/J2EE application. If the folders didn't exist, create it by yourself.ģ. , : Class.forName('.Driver') link Note If you are using Java 5, you must manually load the driver. In this video tutorial I will show you an Eclipse project which is throwing the : exception while running the example program.
Using any kind of text editor, create file inside your Wildfly path, WILDFLY_HOME\modules\system\layers\base\com\mysql\main, and this is the XML file contents of it: This exception : occurs when there is not JDBC driver for MySQL in project.
#Mysql jdbc driver class download
Download MySQL connector from Maven centralĭownload : mysql-connector-java-8.0.17.jarĪnd then put the file under WILDFLY_HOME\modules\system\layers\base\com\mysql\main
Now create /] /subsystem=datasources/jdbc-driver=mysql/:add(driver-module-name=,driver-name=mysql,jdbc-compliant=false,driver-class-name=)ġ. We are all aware that the process of creating a traditional Spring JDBC application is little tedious because of its XML configurations and we need to follow few steps to configure any datasource.
#Mysql jdbc driver class how to
(Specially when we do a copy & paste in such /] module add -name= -dependencies=javax.api, /] :reloadĪfter running above command you should see the module.xml generated in the following location: "wildfly-8.2.1.Final/modules/com/mysql/driver/main/module.xml" I n this article, I am going to explain you how to create / configure a datasource in Spring boot with an example. If you are using JDK 8 or higher, it will automatically load the MySQL JDBC driver, as long as the JAR file is included in the classpath. This is because when we use some text editors, they might append some hidden chars to our files. This section describes how to load the MySQL JDBC driver class - mysql-connector-java-xxx-bin.jar. Try creating the Module itself using the jboss-cli.sh command rather than manually writing the module.xml file.