//Java DB connectivity with Java Jframe  form
// Record Insert code here:

//Add important Package

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
//import java.sql.*;
import java.sql.Statement;
import javax.swing.JOptionPane;

void connect()
{
         try
        {
  String host="jdbc:derby://localhost:1527/ravi";
String UName="ravi";
String UPass="ravi";
Connection con=DriverManager.getConnection(host,UName,UPass);
Statement stmt=con.createStatement();
String sql="insert into dep values('"+txtDepName.getText()+"','"+txtDepInc.getText()+"') ";
stmt.execute(sql);
con.close();
JOptionPane.showMessageDialog(null, "Data sucessfully inserted...");
//jTextField1.setText(null);
        }
         catch( SQLException ex)
        { 
            JOptionPane.showMessageDialog(null, ex.toString());
}
         }