Solve maven build project SQLException: No suitable driver

Problem occurrence and resolution:
    The main c3p0-config.xmlreason is that this time I used the C3P0 connection pool, and the project built by maven did not read my configuration file.The configuration file of the project C3P0 connection pool built by maven cannot be placed directly in the src directory.

Solution:

  1. Create a resources file under src->mainInsert picture description here
  2. Mark the created resources file as a resource directory
    Insert picture description here
  3. The c3p0-config.xmlprofile lost in
    Insert picture description here
  4. Configure the database driver dependencies
    Insert picture description here
  5. I use the 8.0.17 version of the database connection driver.After maven downloads the connection driver, copy 8.0.17 to the additional dependency directory of the jre of the machine running the project.
    Insert picture description here
That's it. Deploying to linux will report the exception of not being able to find the jar package, follow the same method, and then throw this into the jre->lib->ext of linux.

Delete and try to see that my jar package needs to be used
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_41490274/article/details/100123889