JDBC connection to MySQL

Source: Internet
Author: User
Although I have been studying Java for more than two years, I have been using Java for projects ..

Today, we made a test environment, tomcat5.5 + MySQL. I wrote a test page to check the environment and found that the database cannot be connected .. Net will make people lazy. Once installed vs, you can write it with confidence.CodeAccess the database directly ..
In line with the principle of "tailism", I goolge and found a lotArticleThen, configure the value according to the document.
1. Download mysql-connector-java-5.05.jar
2. Copy the jar files to j2sd's targets, JRE directories, Tomcat's comm \ Lib targets, and share \ Lib directories in sequence. According to the author's point of view in the article, the jar files are more easily copied and worry-free.
3. In the document security, classpath is used together with almost all paths.
4. Run a JSP file I wrote to access the database and read data from it.

The result showed that JIT. XX. Mm. Driver could not be found, and changed to com. MySQL. Driver, which made me very puzzled. I did everything in the article. Why is it the same? And the most important environment is the same ..

Refer. . The original article made too many redundant steps.

1. Returns the mysql-connector-java-5.05.jar to a directory of a Java environment.
2. Add the path to this path in classpath
3. Copy the mysql-connector-java-5.05.jar to comm \ Lib in Tomcat
4. JIT. XX. Mm. Driver is no longer in use, 5. For Versions later than 0, use the com. MySQL. Driver Class to create a connection instance.

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.