Netbeans does not recognize import com.mysql.jdbc.jdbc2.optional.MysqlDataSource?

I am trying to access a database using a DataSource, to configure the data source I need to import com.mysql.jdbc.jdbc2.optional.MysqlDataSource , but the problem is that Netbeans does not recognize it, stating that the package does not exist.

(I installed java jdk v.8 and I am using Netbeans IDE v8.0.2)

+4
source share
1 answer

Download the MySql JDBC Jar file from here and follow these steps.

Here are the screenshots for you.

  • Add the JAR file to your project with the right mouse button. Click on the Project Library folder

enter image description here

  • Add Jar / Folder . Browse the Jar file and add it.

enter image description here

  • Import com.mysql.jdbc.jdbc2.optional.MysqlDataSource . Done.

enter image description here

Hope this helps.

+6
source

All Articles