Exception Handling During database connection: Java. SQL. sqlexception: no suitable driver found

Source: Internet
Author: User

Java. SQL. sqlexception: no suitable driver found for this exception occurs for two reasons:

1. There is no proper database driver in the searchable path.

2. the URL provided during database connection is incorrect.

 

Generally, the first condition does not often happen, because we do not install drivers when connecting to the database, and the driver path is basically not a problem.

Most of them are incorrect database connection URLs. In this case, the URL, user name, and password are most often read from the configuration file.

Because the data in the configuration file seems to be correct, it may be caused by formatting of the configuration file, which is inconsistent with the data displayed,

In most cases, invisible characters such as carriage return, line breaks, and tabs are added before and after the data.

 

Solution: 1. Install the correct driver and configure the correct path.

2. Read the database connection URL, user name, and password from the configuration file and perform a special character filter.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.