How to access MySQL through JDBC?
The interface that is used to access the Relational databases is called JDBC or Java Database connectivity. It can be used to build a connection, provide the queries of the database and update whenever required.
The below list elucidates the process of accessing MySQL through JDBC
- Select a Database
- Go to Java EE-Eclipse page and select new then go to project option.
- In the new project window select java project option
- Give a project name in the new Java project window that appears
- Click finish
- Copy the mysql-connecor-java-5.1.35-bin.jar that was previous downloaded
- In the Java-Eclipse window , right click the new java project and create a new folder and name it lib and paste the mysql-connector-java-5.1.35
- Right click the new java project and go to properties
- Select java build path
- Select libraries and open the Add JAR file
- In the JAR selection window you can see the new java project and below the lib option select -connecor-java-5.1.35-bin.jar and click ok
- Select src and new and then go to package
- In new java package folder add a new name with extension .jdbc
- Select he new package folder with extension as .jdbc , go to new and select class
- In the new java class folder name it as Access database and select finish.
- Copy the code from the metadata and paste it in the accessdatabase.java folder
- After pasting it select the entire code from the acessdatabase.java folder and format it
- Now check for any errors
- If error free, then right click and select run as option.
- If successful, you can now access Mysql through JDBC.
Here is the video tutorial of "How to Access MySQL through JDBC?":
You can get more information on various operations for insert, update and delete data from the data base on www.roseindia.net