MySQL in this tutorial) and to establish a database connection with the server via its getConnection() method. DriverManager: this class is used to register driver for a specific database type (e.g.They are all available under the java.sql package: Understand the main JDBC interfaces and classesLet’s take an overview look at the JDBC’s main interfaces and classes with which we usually work. Source Path\To\The\Script\File\SQLScript.sqlHere’s an example screenshot taken while executing the above script in MySQL Command Line Client program:ģ. ) Or if you are using MySQL Command Line Client program, save the above script into a file, let’s say, SQLScript.sql and execute the following command: ![]() `user_id` int(11) NOT NULL AUTO_INCREMENT, Creating a sample MySQL databaseLet’s create a MySQL database called SampleDB with one table Users with the following structure: Execute the following SQL script inside MySQL Workbench: create database SampleDB ![]() Extract the zip archive and put the mysql-connector-java-VERSION-bin.jar file into classpath (in a same folder as your Java source files).Ģ.
0 Comments
Leave a Reply. |