- Building Web Apps with Spring 5 and Angular
- Ajitesh Shukla
- 218字
- 2021-07-02 19:38:24
Using the MySQL connector
Before testing the MySQL database connection from a Java program, one would need to add the MySQL JDBC connector library to the classpath. In this section, you will learn how to configure/add the MySQL JDBC connector library to the classpath while working with the Eclipse IDE or command console.
The MySQL connector (Connector/J) comes in a ZIP file, (*.tar.gz). The MySQL connector is a concrete implementation of the JDBC API. Once extracted, one can see a JAR file with a name such as mysql-connector-java-xxx.jar. The following are the different ways in which this JAR file is dealt with while working with or without IDEs such as Eclipse:
- While working with the Eclipse IDE, one can add the JAR file to the class path by adding it as a library to the Build Path in the project's properties.
- While working with the command console, one needs to specify the path to the JAR file in the -cp or -classpath argument when executing the Java application. The following is the sample command representing the preceding:
java -cp .;/path/to/mysql-connector-java-xxx.jar
com.healthapp.JavaClassName
Note the "." in the classpath (-cp) option. This is there to add the current directory to the classpath as well such that com.healthapp.JavaClassName can be located.
- Visual Studio 2012 Cookbook
- 騰訊iOS測試實踐
- Practical UX Design
- Cassandra Design Patterns(Second Edition)
- Learning Firefox OS Application Development
- SQL Server 2016數據庫應用與開發習題解答與上機指導
- WebRTC技術詳解:從0到1構建多人視頻會議系統
- Flutter跨平臺開發入門與實戰
- PySide 6/PyQt 6快速開發與實戰
- R語言數據可視化:科技圖表繪制
- Learning Splunk Web Framework
- Machine Learning for OpenCV
- 大學計算機應用基礎(Windows 7+Office 2010)(IC3)
- Selenium WebDriver Practical Guide
- Java設計模式深入研究