java practice for beginger

vdahake's Avatar, Join Date: May 2012
Newbie Member
Please give which are most use in java ( I/O main I/o, Thread, Insert data in MySQL, etc) in work . So i become good java programer in future.
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Thread moved to Java Forum
mfred90's Avatar, Join Date: Mar 2012
Here I am trying to give you a tutorial about how to insert value to the database using java.
import java.sql.*;

public class InsertValues{
 public static void main(String[] args) {
 System.out.println("Insert the values to database table!");
  Connection con = null;
  String url = "jdbc:mysql://localhost:3306/";
  String db = "jdbctutorial";
  String driver = "com.mysql.jdbc.Driver";
  con = DriverManager.getConnection(url+db,"root","root");
  Statement st = con.createStatement();
  int val = st.executeUpdate("INSERT employee VALUES("+13+","+"'Aman'"+")");
  System.out.println("1 row affected");
  catch (SQLException s){
  System.out.println("SQL statement is not executed!");
  catch (Exception e){

Last edited by shabbir; 4Jun2012 at 17:21.. Reason: Code blocks