Skip to Content
0
Former Member
Apr 25, 2009 at 10:12 AM

Problem in connecting to oracle DB through NWDS

25 Views

Hi All,

I cannot establish a connection to the oracle DB through the below mentioned code written in webdynpro java. I am new to this area.

Please check what is wrong with this code and suggest me how to resolve this......I have pasted the classes12.jar in the lib folder.

import oracle.jdbc.driver.OracleDriver;

ResultSet resSet = null;

Statement Stat = null;

Connection conn = null;

PreparedStatement pstmt= null;

String url = "jdbc:oracle:thin:@local server:1521:SID";

String user = "ABC";

String password = "123";

try

{

conn = DriverManager.getConnection(url,user,password);

Stat = conn.createStatement();

pstmt = conn.prepareStatement("Select * from tablename");

resSet = pstmt.executeQuery();

wdComponentAPI.getMessageManager().reportSuccess("Result"+resSet);

if (resSet != null)

{

resSet.close(); // close ResultSet

Stat.close(); // close Statement

conn.close();

}

}

catch (Exception e)

{

e.printStackTrace();

}

Regards,

Athulya.