ARMY DATABASE

Design:

SOURCE CODE:
Import Statements:
import java.sql.DriverManager;
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;
import java.sql.ResultSet;

not Entered"). dob=jTextField3.pension.DefaultTableModel.swing.showMessageDialog(this. pension=jTextField4.isEmpty()) JOptionPane.swing.getText().showMessageDialog(this. "Name not Entered"). if(dob.table.JOptionPane. if(name.B. Code for Adding New Record: String name.getText(). salary=jTextField2. .salary.getText().getText(). "Salary not Entered").isEmpty()) JOptionPane. name=jTextField1.O.import javax.showMessageDialog(this. "D.isEmpty()) JOptionPane.dob.designation. if(salary. import javax.

"1234").isEmpty()) JOptionPane.showMessageDialog(this.showMessageDialog(this."ro ot". .sql. designation=jTextField5.forName("java. Connection con=(Connection) DriverManager.getText(). "Pension not Entered").isEmpty()) JOptionPane.if(pension.getConnection ("jdbc:mysql://localhost:3306/IndianArmy".DriverManager"). "Designation not Entered"). if(name. else { try { Class.

getString("Name").createStatement(). ResultSet rs=stmt. Designation FROM soldier WHERE SoldiersName=name"). String designation1=rs. while(rs. String pension1=rs. Pension. dob. String salary1=rs.getString("Designation"). String dob1=rs.Statement stmt=(Statement) con.getString("dob").getString("pension").next()) { String name1=rs.getString("Salary"). Salary.executeQuery("SELECT SoldiersName. . int Found=0.

B. jTextField5.equals(namet)) { Found++.setText(""+Salary).setText(""+Pension).if( name. jTextField3. jTextField4.setText(""+Designation). jTextField2.O.setText(""+D. break. } } if(Found==0) .). } else { continue.

showMessageDialog(this.event .getModel(). try ."Sorry No such name in contact list"). } catch(Exception e) { JOptionPane.awt.JOptionPane.showMessageDialog(this. e. } } } Code For Display: private void jRadioButton1ActionPerformed(java.getMessage()).ActionEvent evt) { DefaultTableModel model= (DefaultTableModel) jTable1.

String Tname. Statement stmt=(Statement) con.sql. else Tname="Official".{ Class.getConnection ("jdbc:mysql://localhost:3306/cbse1".createStatement().isSelected()) Tname="soldier". ResultSet rs=stmt.next()) { . "root". String query="SELECT * FROM "+Tname+". while(rs.".DriverManager"). if(jRadioButton1."1234").forName("java.executeQuery(query). Connection con=(Connection) DriverManager.

O.showMessageDialog(this. model.=rs.getString("Pension").getString("Designation").O. Pension.getMessage()). } } catch(Exception e) { JOptionPane. D.B. Salary. } } } .getString("Salary").B.O. String Salary=rs."). String Pension=rs. Designation}).getString("D.. e.String name=rs. String D. String Designation=rs.getString("name").B.addRow(new Object[] {name.

i++) model. if(rows>0) { for(int i=0. i<rows.awt.event . int rows=model.removeRow(0).ActionEvent evt) { DefaultTableModel model= (DefaultTableModel) jTable1. } } .private void jRadioButton2ActionPerformed(java.getRowCount().getModel().

Output .

BIBLIOGRAPHY 1)Sumita Arora Informatics Practices Class 12 Text Book 2)NCERT Text Book 3)Vikas Gupta Informatics Practices Class 12 Text Book .

ACKNOWLEDGEMENT I wish to express my deep gratitude and sincere thanks to Principal. Priya and Mrs. I. I extend my hearty thanks to Mrs. who guided me to the successful completion of this project. Shree Skanda Central School.Ramya. lecturers. Bangalore. Mr.Prasad.I sincerely appreciate this magnanimity by taking me into there fold for which I shall remain indebted to them. Uttarhalli.P. I take this opportunity to express my deep sense of .

DECLARATION . constant encouragement. which has sustained my efforts at all stages of this project work. I can’t forget to offer my sincere thanks to my classmates who helped me to carry out this project work successfully & for their valuable advice & support. constructive comments. sympathetic attitude and immense motivation. which I received from them time to time.gratitude for his invaluable guidance.

Banglore.I do hereby declare that this project work has been originally carried under the guidance and supervision of Mrs. .Priya and Mrs. Shree Skanda Central Public School.Ramya .

INFORMATICS PRACTICES ARMY DATABASE .