Skip to Content
0
Former Member
Sep 21, 2007 at 05:35 AM

How to display which exception Is Raised?

18 Views

Hi

Experts.

I am trying to connect my webDynpro with oracle.

I had already included Jar at both places.

now I want to display in exception that which error is coming?

I had already written <b> ex.printStackTrace(); </b>

but it is not working.

Code Is given Below.

Connection conn=null;
		try
		{
		wdComponentAPI.getMessageManager().reportException("after 0",false);
		Class.forName("oracle.jdbc.driver.OracleDriver");
		wdComponentAPI.getMessageManager().reportException("after 1st",false);
		DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
		wdComponentAPI.getMessageManager().reportException("after 2nd",false);
		conn =DriverManager.getConnection ("jdbc:oracle:thin:@Server IP:1521:adaniinframs","scott", "tiger");
		wdComponentAPI.getMessageManager().reportException("after 3",false);
		Statement stmt=conn.createStatement(); 
		wdComponentAPI.getMessageManager().reportException("after 4",false);
		ResultSet rs=stmt.executeQuery("select ename from emp where empno=7369"); // select statment
		wdComponentAPI.getMessageManager().reportException("after 5",false);
		while(rs.next())
		{
		wdComponentAPI.getMessageManager().reportException("after 6",false);
		IPrivateDatabaseConnectView.INodeEmpElement a = wdContext.createNodeEmpElement();
		a.setEmpName(rs.getString(1));
		a.setEmpJob(rs.getString(2));
		wdContext.nodeNodeEmp().addElement(a);
		}
		}
		catch(Exception ex)
		{ 
                ex.printStackTrace();
		
		}
 
		finally
		{
		 try
		{
		conn.close(); // closing the connection
		}
		catch(Exception e)
		{  
		ex.printStackTrace();
		}
		}   

Regards

Sunny.