R4R Team working to provide free of cost for experienced and freshers

Tutorials | Examples|Interview Questions and Answers|Java Tutorials| C Tutorials | C++ Tutorials | Spring Tutorials| Hibernate Tutorials | JSP Tutorials | Servelets Tutorials| C# Tutorials | PHP Tutorials etc , Basics | Download Software | Data Types | Variables | Constant | Storage & Classes | Operators | Decisions Making | Loops | Functions| Numbers | Arrays | Pointers | String | Datastructure | Expressions | Preprocessor Statement | I/O | Exception Handling | OOPs Tutorial | Classes and object |C++ Inheritance Overloading | Polymorphism | Abstraction | Encapsulation | Interfaces | Multithreading etc

JDBC

JDBC Projects

JDBC Project 1

Step of the connectivity with MySQL
Previous Home Next

The steps of developing the Java programs that access the MySQL database.

Step1: load the database driver and register it with the driver manager.

Class.forName("com.mysql.jdbc.Driver");

Step 2: In the second step we are create the connection to the database server.

Connection con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/student", "system","sam");

Step 3: In this step you can create the statement object by giving your Oracle.

PreparedStatement stm=con.prepareStatement(“select * from sam”);

Step 4: Now you can execute the SQL query and retrieve the data in the form of ResultSet. In case of delete or update you can execute the SQL and get the information about the SQL execution like no of records deleted or modified etc.

ResultSet rset= stm.executeQuery();

Step 5: Finally you should disconnect your database connection.

Con.close();
Previous Home Next