Dec

04

NOTES OF BCA-V Subject: Java Programming and Dynamic Webpage Design (BCA-S302T)

Dec

03

SERVLET SAMPLE Codes for BCA-V (2017), MGKVP Uinversity

Dec

03

JSP SAMPLE Codes for BCA-V (2017), MGKVP Uinversity

Dec

03

CLICK TO DOWNLOAD All HTML Code for BCA-V (2017), MGKVP Uinversity

Nov

17

import java.sql.*;
import java.io.*;
class TestDb9{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);

Statement stmt=con.createStatement();

//——————— TO DELETE RECORED——–
Console c=System.console();
String empno=c.readLine(“Enter Emp No want to update: “);
String mob=c.readLine(“Enter Mobile Number:”);
String qu=”update emp set mobile='”+mob+”‘ where empno=”+empno;
System.out.println(qu);
int num=stmt.executeUpdate(qu);
if(num==0){
System.out.println(“No such record found”);
}
// ———————— END —————————-
qu=”select * from emp order by empno”;
ResultSet rs=stmt.executeQuery(qu);
while(rs.next()){
System.out.println(rs.getString(“empno”)+”\t”+rs.getString(“ename”).toUpperCase()+”\t”+rs.getString(“mobile”));
}
rs.close();
stmt.close();
con.close();
}catch(Exception e){
System.out.println(e);
}
}
}

Nov

17

import java.sql.*;
import java.io.*;
class TestDb8{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);
System.out.println(“Con established”);
Statement stmt=con.createStatement();
System.out.println(“statement created”);
//——————— TO DELETE RECORED——–
Console c=System.console();
String empno=c.readLine(“Enter Emp No want to delete: “);
String qu=”delete from emp where empno=”+empno;
System.out.println(qu);
int num=stmt.executeUpdate(qu);
if(num==0){
System.out.println(“No such record found”);
}
// ———————— END —————————-
qu=”select * from emp order by empno”;
ResultSet rs=stmt.executeQuery(qu);
while(rs.next()){
System.out.println(rs.getString(“empno”)+”\t”+rs.getString(“ename”).toUpperCase()+”\t”+rs.getString(“mobile”));
}
rs.close();
stmt.close();
con.close();
}catch(Exception e){
System.out.println(e);
}
}
}

Nov

17

import java.sql.*;
import java.io.*;
class TestDb6{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);
System.out.println(“Con established”);
Statement stmt=con.createStatement();
System.out.println(“statement created”);
//——————— TO INSERT RECORED——–
Console c=System.console();
String empno=c.readLine(“Enter Emp No: “);
String empName=c.readLine(“Enter Emp Name: “);
String empMob=c.readLine(“Enter Emp Mobile: “);
String qu=”insert into emp values(“+empno+”,'”+empName+”‘,'”+empMob+”‘)”;
System.out.println(qu);
stmt.execute(qu);
System.out.println(“row inserted”);

// ———————— END —————————-
qu=”select * from emp order by empno”;
ResultSet rs=stmt.executeQuery(qu);
while(rs.next()){
System.out.println(rs.getString(“empno”)+”\t”+rs.getString(“ename”).toUpperCase()+”\t”+rs.getString(“mobile”));
}
rs.close();
stmt.close();
con.close();
}catch(Exception e){
System.out.println(e);
}
}
}

Nov

17

import java.sql.*;
import java.io.*;
class TestDb5{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);
System.out.println(“Con established”);
Statement stmt=con.createStatement();
System.out.println(“statement created”);
String qu=”select * from emp”;
ResultSet rs=stmt.executeQuery(qu);
while(rs.next()){
System.out.println(rs.getString(“empno”)+”\t”+rs.getString(“ename”).toUpperCase()+”\t”+rs.getString(“mobile”));
}
}catch(Exception e){
System.out.println(e);
}
}
}

Nov

17

import java.sql.*;
import java.io.*;
class TestDb4{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);
System.out.println(“Con established”);
Statement stmt=con.createStatement();
System.out.println(“statement created”);
Console c=System.console();
String empno=c.readLine(“Enter Emp No: “);
String empName=c.readLine(“Enter Emp Name: “);
String empMob=c.readLine(“Enter Emp Mobile: “);
String qu=”insert into emp values(“+empno+”,'”+empName+”‘,'”+empMob+”‘)”;
System.out.println(qu);
stmt.execute(qu);
System.out.println(“row inserted”);
}catch(Exception e){
System.out.println(e);
}
}
}

Nov

17

import java.sql.*;
import java.io.*;
class TestDb3{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);
System.out.println(“Con established”);
Statement stmt=con.createStatement();
System.out.println(“statement created”);
Console c=System.console();
String qu=c.readLine(“Enter insert sql : “);
//qu=”insert into emp values(3,’uu’,’70070′)”;
System.out.println(qu);
stmt.execute(qu);
System.out.println(“row inserted”);
}catch(Exception e){
System.out.println(e);
}
}
}

Nov

17

import java.sql.*;
import java.io.*;
class TestDb2{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);
System.out.println(“Con established”);
Statement stmt=con.createStatement();
System.out.println(“statement created”);
/*Console c=System.console();
String qu=c.readLine(“Enter sql for table: “);*/
String qu=”insert into emp values(3,’uu’,’70070′)”;
System.out.println(qu);
stmt.execute(qu);
System.out.println(“row inserted”);
}catch(Exception e){
System.out.println(e);
}
}
}

Nov

17

import java.sql.*;
import java.io.*;
class TestDb1{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);
System.out.println(“Con established”);
Statement stmt=con.createStatement();
System.out.println(“statement created”);
Console c=System.console();
String qu=c.readLine(“Enter sql for table: “);
System.out.println(qu);
stmt.execute(qu);
System.out.println(“table sql executed”);
}catch(Exception e){
System.out.println(e);
}
}
}

Nov

17

import java.sql.*;
class TestDb{
public static void main(String ard[]){
try{
Class.forName(“sun.jdbc.odbc.JdbcOdbcDriver”);
Connection con=DriverManager.getConnection(“jdbc:odbc:BCADSN”,”system”,”ram”);
System.out.println(“Con established”);
Statement stmt=con.createStatement();
System.out.println(“statement created”);
String qu=”drop table emp”;
stmt.execute(qu);
System.out.println(“table dropped”);
qu=”create table emp(empno number(2),ename varchar2(50),mobile varchar2(20))”;
System.out.println(qu);
stmt.execute(qu);
System.out.println(“table created”);
}catch(Exception e){
System.out.println(e);
}
}
}