- 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.
- iOS Game Programming Cookbook
- OpenStack Cloud Computing Cookbook(Third Edition)
- oreilly精品圖書:軟件開發者路線圖叢書(共8冊)
- OpenNI Cookbook
- Mastering Kali Linux for Web Penetration Testing
- Working with Odoo
- Learning OpenStack Networking(Neutron)
- Java程序設計案例教程
- 開源項目成功之道
- Hacking Android
- 超簡單:用Python讓Excel飛起來(實戰150例)
- 數字媒體技術概論
- Elasticsearch搜索引擎構建入門與實戰
- 計算機系統解密:從理解計算機到編寫高效代碼
- Python Django Web從入門到項目實戰(視頻版)