Issue
I am trying to run a test Maven web application (*.war file) that Inserts data into a mySQL database using tomcat. In the maven project itself I have added all the neccesary dependancies to do this. However when I try and run it on the Tomcat server I get this error:
No suitable driver found for jdbc:mysql://localhost:3306/Companies
*"/Companies" is the name of my database.
I assmumed this ment that my dependancies were not being added to tomcat during deployment. Other simular questions suggests to go to "Deployement assembly" to add the maven dependancies.
However this option is only available in eclipse and am using netbeans to run my project.
My question is how would I do the same on Netbeans?
Solution
Decide where you want to have the mariadb driver. It could be embedded in the application, then simply add that dependency to your pom (it is a mariadb and mysql driver):
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.0.7</version>
</dependency>
If you prefer that dependency to be resolved by Tomcat, simply drop that jar file into the $CATALINA_BASE/lib
directory.
The advantage is that the responsibility for upgrading mysql in connection with the driver can be delegated away from development.
Answered By - Hiran Chaudhuri
Answer Checked By - Candace Johnson (JavaFixing Volunteer)