cancel
Showing results for 
Search instead for 
Did you mean: 

what is the process to connect to database from wbedynpro ?

Former Member
0 Kudos

hi all

i am goutham

my dought is

what is the process to connect to database from WebDynpro ? please tell me the detailed procedure

thanks in advance

goutham.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Goutham,

Check the threads below,

It will be very useful

Regards,

Saravanan K

sridhar_k2
Active Contributor
0 Kudos

Hi,

I think we don't have predefined process to connect to Database from Web Dynpro.

You can write all the logic in a Individual file (Normal Java Program - Helper Class). And use it wherever you want to connect to the Data Base.

Connection connection = null;

try {

// Load the JDBC driver

String driverName = "oracle.jdbc.driver.OracleDriver";

Class.forName(driverName);

// Create a connection to the database

String serverName = "127.0.0.1";

String portNumber = "1521";

String sid = "mydatabase";

String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;

String username = "username";

String password = "password";

connection = DriverManager.getConnection(url, username, password);

} catch (ClassNotFoundException e) {

// Could not find the database driver

} catch (SQLException e) {

// Could not connect to the database

}

Former Member
0 Kudos

Hi Goutham,

First you have to determine the Database, then You have to create the Datasource,

Then datasource is a alias name.

Then you use the following code

InitialContext initialContext = new InitialContext();

DataSource dataSource = (DataSource)initialContext.lookup("jdbc/CareView");

java.sql.Connection conn = dataSource.getConnection();

Now you get the access to the database.

Then you will find the Table to manipulate

sample coding:

Then you can use the

Statement st=conn.createStatement();

Resultset rs=st.executeQuery("select * from <Table>);

then you can manipulate the resultset.

Hope this will help

Message was edited by: Saravanan K