Ds adb dcet raheem 17742004 execution steps 1 run the

Info icon This preview shows pages 10–17. Sign up to view the full content.

View Full Document Right Arrow Icon
}
Image of page 10

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
DS & ADB DCET RAHEEM UNNISA 11 160317742004 EXECUTION STEPS: 1) Run the IDL-to-Java compiler, idlj , on the IDL file to create stubs and skeletons idlj fall Hello.idl 2) Compile the .java files, including the stubs and skeletons (which are in the directory HelloApp ) Javac *.java HelloApp/*.java 3) Start orbd Start orbd ORBInitialPort 1050 4) Run Server Application java HelloServer ORBInitialPort 1050 4) Run Client Application java HelloClient ORBInitialPort 1050 Output:
Image of page 11
DS & ADB DCET RAHEEM UNNISA 12 160317742004 4. Implementation of a simple JDBC program to demonstrate Database connection. Oracle.java import java.sql.*; class db { Connection c; Statement p; ResultSet rs; db() throws Exception { Class.forName("oracle.jdbc.driver.OracleDriver"); c=DriverManager.getConnection("jdbc:oracle:thin:@192.168.2.60:1521:demo","scott","ti ger"); } void finish() throws Exception { rs.close(); c.close(); } void exequery() throws Exception { p=c.createStatement(); rs=p.executeQuery("select * from family"); System.out.println("hello"); while(rs.next() !=false) { System.out.println("inside while"); System.out.println("Id is: "+rs.getInt(1)); System.out.println("Name is: "+rs.getString(2)); System.out.println("Age is: "+rs.getString(3)); System.out.println("balance is: "+rs.getInt(4)); System.out.println(" "); }
Image of page 12

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
DS & ADB DCET RAHEEM UNNISA 13 160317742004 } } class Oracle { public static void main(String args[]) throws Exception { db obj=new db(); try { System.out.println("hllo"); obj.exequery(); } catch(Exception e) { System.out.println("Error occured: "+e); } finally { obj.finish(); } } } Execution Steps: javac Oracle.java java Oracle Output:
Image of page 13
DS & ADB DCET RAHEEM UNNISA 14 160317742004 5. Implementation of an employee application having a remote method to find details of employee which when supplied by empid. Implement the above using CORBA. DATABASE TABLE: Creating Table: create table myemp(empid number(10), name varchar(20), DOJ varchar(20), service varchar(20), salary number(10)); Inserting values into table: i nsert into myemp values(1,’ra vi ’,’10 -aug- 08’,’manager’,10000); insert into myemp values(2 ,’boss’,’10 -sept-17 ’,’ceo’,20 000); Executing query: select * from myemp; Saving Table: commit; PROGRAM: IDL Program: emp_intf.idl module emp { interface emp_intf{ string getStatus(in long id); }; };
Image of page 14

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
DS & ADB DCET RAHEEM UNNISA 15 160317742004 Implementation Program: implservent.java import emp.*; import java.sql.*; class implservent extends _emp_intfImplBase { Connection c; PreparedStatement ps; ResultSet rs; public implservent() throws Exception{ Class.forName("oracle.jdbc.driver.OracleDriver") ; c=DriverManager.getConnection("jdbc:oracle:thin:@ 192.168.2.60:1521:demo”,”scott”,”ti ger” ); } public String getStatus(int id) { try { ps=c.prepareStatement("select * from myemp where EMPID=?"); ps.setInt(1,id); rs=ps.executeQuery(); if (rs.next()) return rs.getString(5); else return "~"; } catch(Exception e) {} return "~"; } }
Image of page 15
DS & ADB DCET RAHEEM UNNISA 16 160317742004 Server Program: Server1.java import emp.*; import org.omg.CORBA.*; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; public class Server1 { public static void main(String args[])throws Exception { ORB orb=ORB.init(args,null); implservent obj=new implservent(); orb.connect(obj); NamingContext nobj=NamingContextHelper.narrow(orb.resolve_initial_references("NameService"));
Image of page 16

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 17
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern