cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent : Hoe to connect to a ORACLE database throught WEBDYNPRO JAVA

Former Member
0 Kudos

HI All

i am very new to Developer Studio,

i want to connect to an oracle database through wedynpro java.

i have seen some tutorials on SDN. i know something about adding external JARs and OJDBC .

Can anyone send me the sample code to connect to a database

<b>very urgent</b>

Thanks in advance

Sushma

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sushma

Ask your system Admin for servername,portnumber of database server

Connection conn=null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
conn =DriverManager.getConnection ("jdbc:oracle:thin:@<servername>:<portnumber>:DB","uname", "pwd");
Statement stmt=conn.createStatement();
ResultSet rs=stmt.executeQuery("select * from <tablename>"); // select statment
while(rs.next())
{

IXXElement nodeConnection=wdContext.createXXElement(); //creating a node to store the data from oracle

nodeConnection.setYY(rs.getInt("YY")); // setting the values into input fields
nodeConnection.setAA(rs.getInt("AA"));
nodeConnection.setBB(rs.getInt("BB"));
...
...
..

wdContext.nodeXX().addElement(nodeConnection); // adding the node 
}
}
catch(Exception ex)
{
}
finally
{
try
{
conn.close(); // closing the connection
}
catch(Exception e)
{
}
}

welcome to SDN and All the best from SDN Webdynpro JAVA

Regards
Chaitanya.A

Former Member
0 Kudos

Hi Chaitanya

thanks for the immediate reply

i will try and let you know soon.

thank you

Sushma

Former Member
0 Kudos

Hi Chaitanya,

It working fine.

Thanks alot

Sushma

Answers (0)