Java Insert into Table JDBC Concepts

Java Insert into Table JDBC Concepts. You can insert the row in different database like Oracle, MySql, Access, SQL Server etc,. This Java Insert into Table DB (database) example describes the basic operations performed on the JDBC Insert into Table database connectivity code. In this example you will learn about how to write java code for Insert into Table with oracle database.

The following Core Java database connection program will help you to understand how to insert data into Oracle database tables through java code. This simple Java example program will make you to understand the flow and steps to develop Java Insert into table concept.


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class InsertRowIntoTable{
public static void main(String args[]){
Connection con=null;
Statement st = null;
try {
st = con.createStatement();
int b;
b=st.executeUpdate(“insert into eshusoft values(‘myuser’,'mypwd’)”);
System.out.print(“rows inserted: “+b);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
} catch (SQLException e) {
// TODO Auto-generated catch block

rows inserted: 1