cancel
Showing results for 
Search instead for 
Did you mean: 

Othe options to connect to an oracle database

Former Member
0 Kudos

Hi All,

We have a wd application connected to an oracle database using JDBC:

Connection conn = DriverManager.getConnection( "jdbc:oracle:thin:@oracle server ip:port:sid", "user name", "password");

However, the user name and password to connect to the database were hard-coded. We wanted to remove this from the code. Thus, we need to find other way to connect to an oracle database.

We tried to create an oracle datasource in the VA. However, this is not an option anymore as the datasource was deleted during our system's upgrade. This could be an issue on going as we have to re-create it after each upgrade in the system.

Is there any other way to connect to oracle database without exposing the user name and password?

Regards,

Marlyn

Edited by: Lene Agco on Aug 19, 2010 9:12 AM

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member214651
Active Contributor
0 Kudos

Hi,

U can create a JDBC destination in NWA using the url http://<server>:<port>/nwa. Under Destination section, u can create a JDBC destination providing all the required details like url of the DB server, connection string, username and password.

Regards,

Poojith MV

Former Member
0 Kudos

Do you mean the datasource created in NWA can't be removed or affected by system upgrades? Because that is our issue with J2EE VA.

Also, I think we have several application servers. Do we need to create the datasource in all these application servers?

Former Member
0 Kudos

I am not sure why you think a datasource would be deleted when you upgrade?

Also you only need to update the datasource in the main server instance; and it propagates by itself to other instances and their nodes in the cluster.

But in any event recreating a data source is trivial and does not take longer than a minute.

This is the clearly correct manner of connecting. I would not recommend anything else.

Otherwise, if you really want to get all convoluted on yourself you need to store the username and password in something that is not "code" in order for it not to be hardcoded (self-evidently). There are umpteen options for this. For example in a properties file that is controlled by VA Config. In common a file share . etc etc etc. Then your code needs to access this file. You really are making more trouble for yourself this way.

But note when creating the data source you also need to have access the Oracle jdbc drivers. The best way is to put the driver into an external library DC and deploy that in a J2EE library server component. This ensure that the server and the application are using the same classes and prevents class cast exceptions if you are wanting to use any of the specialised Oracle functionality.

You then need to create the driver in VA, and when you do this you get an option to search through the library files for it. Also you must remember on the other side, to reference the J2EE library sda from the deployable your application has been put in.

I trust you are not trying to connect to data sources directly from web dynpro. This is something that should be far down the architecture.

If this helps please award points.

Thanks,

Ilan

former_member214651
Active Contributor
0 Kudos

Hi,

Yes. the datasource and other information in NWA does not get deleted even after u upgrade your server.

Regards,

Poojith MV

Former Member
0 Kudos

Hmm. I see you are trying to connect from within a Web Dynpro application.

Why?

Do you not use the J2EE server for anything?

--

ilAn

Former Member
0 Kudos

It is the Basis team who said that the datasource was deleted when we upgraded our system. I don't have access in VA or NWA that's why I can't see/prove it by myself.

Hmm. I see you are trying to connect from within a Web Dynpro application.

Why?

That's why I posted this question to look for better way to connect to an oracle database

Do you not use the J2EE server for anything?

Like what do you mean for anything?

Former Member
0 Kudos

It is the Basis team who said that the datasource was deleted when we upgraded our system. I don't have access in VA or NWA that's why I can't see/prove it by myself.

Well it should not have been. If it was something was done incorrectly.

Hmm. I see you are trying to connect from within a Web Dynpro application.Why?

That's why I posted this question to look for better way to connect to an oracle database

You should connect to a datasource from a DAO. The DAO should be used by a pojo OO system. an EJB facade should expose the OO system as a model. Dynpro should import the model. This does not change the fact that you should be using a datasource to connect to Oracle. I am just saying you should be using it from lower down the stack.

Do you not use the J2EE server for anything?

Like what do you mean for anything?

As representing the model in the model-view-controller pattern.