Recent Posts
- NCC Punjab LDC Results 2013 NCCPunjab.com Interview Selected Candidates List
- RGUHS PGSSET Super Speciality 2013 Exam www.logisys.net.in Online Application
- RKCL RS-CIT Results 2013 rkcl.in RSCIT Final Exam May Result 2013
- TNEB Electricity Bills Online Payment tnebnet.org/awp/login Tamilnadu EB Payment System
- Kerala LET 2013 Fee Structure for 2013-14 Engineering College Admission
Discussion Forum
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.
Program:
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 {
Class.forName(“oracle.jdbc.driver.OracleDriver”);
con=DriverManager.getConnection(“jdbc:oracle:thin:@localhost:1521:ORCL”,”scott”,”tiger”);
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
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
Result:
rows inserted: 1
