B. Tech SecSikar 5th Sem Result IT 2011 .. A Quick View
| Roll No | Names | Backs | Total | IDs |
|---|---|---|---|---|
| 08ESOIT001 | ADITYA SAIN | 2 | 565 | Facebook Google+ |
| 08ESOIT002 | AJAY PAL SINGH | 6 | 427 | Facebook Google+ |
| 08ESOIT004 | ANIRUDHA SINGH | - | 622 | Facebook Google+ |
| 08ESOIT005 | ARVIND | - | 586 | Facebook Google+ |
| 08ESOIT006 | ASHISH DEEDWANIA | - | 649 | Facebook Google+ |
| 08ESOIT007 | BHARAT PAREEK | - | 681 | |
| 08ESOIT008 | BHARAT SHEKHWAT | 6 | 383 | |
| 08ESOIT009 | BHUPENDRA SINGH | - | 619 | |
| 08ESOIT010 | BIRDI CHAND | 4 | 517 | |
| 08ESOIT011 | DEVMURARI PRATIK | 6 | 416 | |
| 08ESOIT012 | EKTA VASUDEVA | - | 560 | |
| 08ESOIT013 | GOURAV SHARMA | - | 700 | |
| 08ESOIT014 | GOURAV SHRIVASTAV | - | 681 | |
| 08ESOIT015 | HEMRAJ | - | 582 | |
| 08ESOIT016 | HIMANSHU PRAJAPAT | - | 602 | |
| 08ESOIT017 | INDRAJ SHARMA | - | 782 | |
| 08ESOIT018 | JAY PRAKASH PUJARI | 2 | 594 | |
| 08ESOIT019 | JITENDRA CHAWALA | 4 | 486 | |
| 08ESOIT020 | JITESH AGARWAL | - | 642 | |
| 08ESOIT021 | KAMAL KANT | 1 | 566 | |
| 08ESOIT022 | KHUSHBOO JAIN | - | 762 | |
| 08ESOIT023 | KRISHAN GOPAL | 4 | 570 | |
| 08ESOIT024 | KULDEEP MEEL | 4 | 459 | |
| 08ESOIT025 | MAHENDRA SINGH | 1 | 572 | |
| 08ESOIT026 | MANISH KUMAR SAINI | - | 717 | |
| 08ESOIT027 | MANOJ KUMAR SWAMI | - | 642 | |
| 08ESOIT028 | MAHAMMAD SHAKIR | - | 606 | |
| 08ESOIT029 | MOHIT SAINI | - | 696 | |
| 08ESOIT030 | NAVEEN JANGIR | - | 588 | |
| 08ESOIT031 | NAVEEN KUMAR | 5 | 488 | |
| 08ESOIT032 | NEELAM SHEKHAWAT | - | 658 | |
| 08ESOIT033 | NITISH BHARDWAJ | - | 702 | |
| 08ESOIT034 | PANKAJ KUMAR | - | 696 | |
| 08ESOIT035 | PARVEEN KHAN | - | 635 | |
| 08ESOIT036 | PRAJAPATI HANSRAJ | - | 663 | |
| 08ESOIT037 | PRAKASH CHAND | - | 642 | |
| 08ESOIT038 | PRATIBHA FAGERIA | - | 676 | |
| 08ESOIT039 | PREETI KUMARI | - | 719 | |
| 08ESOIT040 | PRIYANKA | 1 | 598 | |
| 08ESOIT041 | RAJENDRA BAGARIYA | - | 657 | |
| 08ESOIT042 | RAMAWTAR | - | 687 | |
| 08ESOIT043 | RANVEER SINGH | - | 647 | |
| 08ESOIT044 | RATANLAL SAINI | - | 583 | |
| 08ESOIT045 | RAVIKANT DADHICH | - | 597 | |
| 08ESOIT046 | ROHITASH SWAMI | 2 | 566 | |
| 08ESOIT047 | SANANDAN SHARMA | 3 | 533 | |
| 08ESOIT048 | SANDEEP KUMAR | - | 563 | |
| 08ESOIT049 | SANDEEP MEEL | 4 | 498 | |
| 08ESOIT050 | SANDEEP MISHRA | 1 | 611 | |
| 08ESOIT051 | SANJAY JANGIR | - | 663 | |
| 08ESOIT052 | SHASHANK DAVE | - | 667 | |
| 08ESOIT053 | TANUJ KUMAR BHATT | - | 631 | |
| 08ESOIT054 | VASEEM AKRAM | - | 637 | |
| 08ESOIT055 | VIKAS KUMAR | 1 | 584 | |
| 08ESOIT056 | VIKASH KALER | - | 698 | |
| 08ESOIT057 | VINOD KUMAR | - | 592 | |
| 08ESOIT058 | VINOD SHARMA | - | 680 | |
| 08ESOIT300 | MAHIPAL SINGH | - | 713 | |
| 08ESOIT301 | VIJAY KUMAR SAINI | - | 584 |
How to Insert or Get Back Image File with DataBase in using Java Programs
import java.sql.*;
import java.util.*;
import java.io.*;
public class InsertBlob
{
public static void main(String ar[])
{
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/college","root","me");
String qry = "insert into imagee values(?,?,?)";
PreparedStatement ps=con.prepareStatement(qry);
ps.setString(1,"Chetan");
ps.setString(2,"Chauhan");
File f = new File("Butterfly.jpg");
FileInputStream fis = new FileInputStream(f);
System.out.println((int)f.length());
ps.setBinaryStream(3,fis,(int)f.length());
int i = ps.executeUpdate();
System.out.println(i+ " Record inserted successfully");
}
catch(Exception e)
{
System.out.println(e);
}
}
}
...........................
To Get Image From DataBase
<%@page import="java.sql.*,java.io.*"%>
<% InputStream sImage; response.setContentType("image/jpeg"); try { Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/college","root","me"); Statement stmt = con.createStatement(); String qry="select * from imagee"; ResultSet rs=stmt.executeQuery(qry); if(rs.next()) { byte[] bytearray = new byte[1048576]; response.setContentLength(bytearray.length); int size=0; sImage = rs.getBinaryStream(3); //response.reset(); while((size=sImage.read(bytearray))!= -1) { response.getOutputStream().write(bytearray,0,size); } } } catch(Exception e) { System.out.println(e); } %>
import java.util.*;
import java.io.*;
public class InsertBlob
{
public static void main(String ar[])
{
try
{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/college","root","me");
String qry = "insert into imagee values(?,?,?)";
PreparedStatement ps=con.prepareStatement(qry);
ps.setString(1,"Chetan");
ps.setString(2,"Chauhan");
File f = new File("Butterfly.jpg");
FileInputStream fis = new FileInputStream(f);
System.out.println((int)f.length());
ps.setBinaryStream(3,fis,(int)f.length());
int i = ps.executeUpdate();
System.out.println(i+ " Record inserted successfully");
}
catch(Exception e)
{
System.out.println(e);
}
}
}
...........................
To Get Image From DataBase
<%@page import="java.sql.*,java.io.*"%>
<% InputStream sImage; response.setContentType("image/jpeg"); try { Class.forName("com.mysql.jdbc.Driver"); Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/college","root","me"); Statement stmt = con.createStatement(); String qry="select * from imagee"; ResultSet rs=stmt.executeQuery(qry); if(rs.next()) { byte[] bytearray = new byte[1048576]; response.setContentLength(bytearray.length); int size=0; sImage = rs.getBinaryStream(3); //response.reset(); while((size=sImage.read(bytearray))!= -1) { response.getOutputStream().write(bytearray,0,size); } } } catch(Exception e) { System.out.println(e); } %>
FrameWork Program Collection in Java
DemoAL.java
import java.util.ArrayList;
import java.util.Iterator;
public class DemoAL {
public static void main(String[] args)
{
ArrayList al=new ArrayList();
al.add("JAVA");
al.add("PHP");
al.add("ORACLE");
al.add("ASP.NET");
System.out.println(al);
System.out.println("-------------------------------------");
/*for(String s:al)
{
System.out.println(s);
}*/
Iterator itr=al.iterator();
while(itr.hasNext())
{
System.out.println(itr.next());
}
}
}
-----------------------
DemoALDataBase
import java.util.ArrayList;
import java.sql.*;
class DemoDB
{
String user,pass;
int sno;
DemoDB(String user,String pass,int sno)
{
this.user=user;
this.pass=pass;
this.sno=sno;
}
}
public class DemoALDataBase {
public ArrayList showResultAL()
{
ArrayList al=new ArrayList();
try
{
Class.forName("com.mysql.jdbc.Driver"); //type 4 driver
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/college","root","rat");//connection
System.out.println("Connection successful:"+con);
Statement stmt=con.createStatement();//creating statement for the further
ResultSet res=stmt.executeQuery("select * from login");
while(res.next())
{
String u=res.getString(1);
String p=res.getString(2);
int sno=res.getInt(3);
al.add(new DemoDB(u,p,sno));
}
}
catch(Exception e )
{
}
System.out.println("size is :"+al.size());
return al;
}
public static void main(String args[])
{
DemoALDataBase ob=new DemoALDataBase();
ArrayList al=ob.showResultAL();
DemoDB obj=al.get(2);
System.out.println(obj.user+","+obj.pass+","+obj.sno);
/* for(DemoDB obj:al)
{
System.out.println(obj.user+","+obj.pass+","+obj.sno);
}*/
}
}
-----------------------------
DemoHashMap.java
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
public class DemoHashMap {
public static void main(String[] args) {
//create HashMap object
HashMap hMap = new HashMap();
//add key value pairs to HashMap
hMap.put("1","ram");
hMap.put("2","shyam");
hMap.put("3","mohan");
/*
get Collection of values contained in HashMap using
Collection values() method of HashMap class
*/
Collection c = hMap.values();
//obtain an Iterator for Collection
Iterator itr = c.iterator();
//iterate through HashMap values iterator
while(itr.hasNext())
System.out.println(itr.next());
}
}
----------------------------
DemoHashMap1.java
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
public class DemoHashMap1 {
public static void main(String[] args) {
//create HashMap object
HashMap hMap = new HashMap();
//add key value pairs to HashMap
hMap.put("1","java");
hMap.put("2","php");
hMap.put("3","oracle");
Set s=hMap.keySet();
System.out.println("size is :"+s.size());
String arr[]=new String[s.size()];
Iterator itr=s.iterator();
for(int i=0;i
{
arr[i]=itr.next();
System.out.println(arr[i]+":"+hMap.get(arr[i]));
}
// System.out.println(hMap.get("3"));
}
}
import java.util.ArrayList;
import java.util.Iterator;
public class DemoAL {
public static void main(String[] args)
{
ArrayList al=new ArrayList();
al.add("JAVA");
al.add("PHP");
al.add("ORACLE");
al.add("ASP.NET");
System.out.println(al);
System.out.println("-------------------------------------");
/*for(String s:al)
{
System.out.println(s);
}*/
Iterator itr=al.iterator();
while(itr.hasNext())
{
System.out.println(itr.next());
}
}
}
-----------------------
DemoALDataBase
import java.util.ArrayList;
import java.sql.*;
class DemoDB
{
String user,pass;
int sno;
DemoDB(String user,String pass,int sno)
{
this.user=user;
this.pass=pass;
this.sno=sno;
}
}
public class DemoALDataBase {
public ArrayList showResultAL()
{
ArrayList al=new ArrayList();
try
{
Class.forName("com.mysql.jdbc.Driver"); //type 4 driver
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/college","root","rat");//connection
System.out.println("Connection successful:"+con);
Statement stmt=con.createStatement();//creating statement for the further
ResultSet res=stmt.executeQuery("select * from login");
while(res.next())
{
String u=res.getString(1);
String p=res.getString(2);
int sno=res.getInt(3);
al.add(new DemoDB(u,p,sno));
}
}
catch(Exception e )
{
}
System.out.println("size is :"+al.size());
return al;
}
public static void main(String args[])
{
DemoALDataBase ob=new DemoALDataBase();
ArrayList al=ob.showResultAL();
DemoDB obj=al.get(2);
System.out.println(obj.user+","+obj.pass+","+obj.sno);
/* for(DemoDB obj:al)
{
System.out.println(obj.user+","+obj.pass+","+obj.sno);
}*/
}
}
-----------------------------
DemoHashMap.java
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
public class DemoHashMap {
public static void main(String[] args) {
//create HashMap object
HashMap hMap = new HashMap();
//add key value pairs to HashMap
hMap.put("1","ram");
hMap.put("2","shyam");
hMap.put("3","mohan");
/*
get Collection of values contained in HashMap using
Collection values() method of HashMap class
*/
Collection c = hMap.values();
//obtain an Iterator for Collection
Iterator itr = c.iterator();
//iterate through HashMap values iterator
while(itr.hasNext())
System.out.println(itr.next());
}
}
----------------------------
DemoHashMap1.java
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
public class DemoHashMap1 {
public static void main(String[] args) {
//create HashMap object
HashMap hMap = new HashMap();
//add key value pairs to HashMap
hMap.put("1","java");
hMap.put("2","php");
hMap.put("3","oracle");
Set s=hMap.keySet();
System.out.println("size is :"+s.size());
String arr[]=new String[s.size()];
Iterator itr=s.iterator();
for(int i=0;i
{
arr[i]=itr.next();
System.out.println(arr[i]+":"+hMap.get(arr[i]));
}
// System.out.println(hMap.get("3"));
}
}
A Simple Struts Program to Verify User Name or Password
DemoAction.java
package com.rat.action;
import java.sql.*;
import java.util.ArrayList;
import java.util.Map;
import org.apache.struts2.interceptor.ApplicationAware;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;
public class DemoAction extends ActionSupport implements Preparable,ModelDriven
{
DemoBean obj;
Connection con;
Statement stmt;
PreparedStatement ps;
public void prepare() throws Exception
{
obj=new DemoBean();
try
{
Class.forName("com.mysql.jdbc.Driver"); //type 4 driver
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/college","root","rat");//connection
System.out.println("Connection successful:"+con);
stmt=con.createStatement();
}
catch(Exception e)
{
e.printStackTrace();
}
}
_________________________________________________
DemoBean.java
package com.rat.action;
public class DemoBean
{
private String uname="",pass="";
public void setUname(String uname)
{
this.uname=uname;
}
public void setPass(String pass)
{
this.pass=pass;
}
public String getUname()
{
return uname;
}
public String getPass()
{
return pass;
}
}
_________________________________________________
ViewAllAction.java
package com.rat.action;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Map;
import org.apache.struts2.interceptor.ApplicationAware;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import com.opensymphony.xwork2.Preparable;
public class ViewAllAction extends ActionSupport implements Preparable,ApplicationAware
{
Connection con;
Statement stmt;
DemoBean obj;
Map application;
public void setApplication(Map application)
{
this.application=application;
}
public void prepare()
{
try
{
Class.forName("com.mysql.jdbc.Driver"); //type 4 driver
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/college","root","rat");//connection
System.out.println("Connection successful:"+con);
stmt=con.createStatement();
}
catch(Exception e)
{
e.printStackTrace();
}
}
Subscribe to:
Posts (Atom)












