简体   繁体   中英

SEVERE: No suitable driver found (MySQL)

I have a web based application where each three seconds i connect to a database and query data from gps devices.

Unfortunatelly when the application works for more than few hours out of no where i get the exception: "SEVERE: No suitable driver found for jdbc .... ". The application still works and connects to the database but the message get prints each time i request new data.

Why do i get this exception? Why it appears only after a few hours of work?

Any solution?

Maybe somewhere you have placed an ill-formed database connection URL for which your DriverManager cannot find a suitable driver.

For example, say you need an URI like "jdbc:mysql://my_database_host/test" and somewhere in your code there is a "jdbc:MySql://my_database_host/test" which would fail.

However, I think that the real problem lies here:

I have a web based application where each three seconds i connect to a database

I suggest you that you consider changing this design to a managed connection pool, be it your application server native one, or the implementation you like the most (dbcp, c3p0, etc.). This way your application will gain performance (you will work with a set of connections opened beforehand, so you save the time and headaches to be opening them) and scalability (does your application open connections frequently for each request? Have you considered the consequences to do so in a frequently requested production environment? Much better to have a limit to open connections)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM