cancel
Showing results for 
Search instead for 
Did you mean: 

Error when trying to connect Oracle through WD DC

0 Kudos

Hi all,

When I work on a local project and add classes12.jar to lib folder, I connect successfully to DB and extract data.

However, I tried to use WD DC project, and for this I've created external lib,added the same jar file and added it to WD DC as used DC.

But here I'm getting error: "No suitable driver"

I'm getting the same error also when I'm not use the external DC.

I guess I'm doing something wrong.

Does anyone has idea what I need to do in order to solve this problem?

Thanks

Ami

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Amy:

Configure your DB at Visual Administrator to avoid Hardcode:

Open Visual Administrator --> JDBC connector

Step 1. Create a new Driver or use an existing one

Name: ORACLE_DRIVER_JDBC

Lib(s): classes111.jar

SQLEngine = Vendor_SQL

Step 2. Create a new DataSource

NOTE: the property names are case-sensitive and you must use {url, user, password} and not {URL, User, Password}.

DataSource Name :

JDBC Version : 2.0 (with XA Support)

Object Factory : oracle.jdbc.pool.OracleDataSourceFactory

DataSource Type : ConnectionPoolDataSource

CPDS Classname : oracle.jdbc.pool.OracleConnectionPoolDataSource

Properties:

url = jdbc:oracle:thin:@ +

SQL Engine

Vendor_SQL

Step 3. Stop/start the J2EE Engine

In your code:

InitialContext initialContext = new InitialContext();

DataSource dataSource = (DataSource)initialContext.lookup("jdbc/< define Alias>");

//Create a connection to the database

if (connection ==null){

connection = dataSource.getConnection();

}

Hope it helps you

Rocío.

Edited by: Rocío Lorena Suárez on Sep 11, 2008 5:32 PM

Former Member
0 Kudos

Hi,

Have you pasted the oracle driver in the correct path?

Regards

Ayyapparaj

0 Kudos

Thanks Ayyapparaj for your reply.

I added the oracle driver as described in SAP documentation:

Link: http://help.sap.com/saphelp_nw70/helpdata/en/46/2899fb035d4f07e10000000a114a6b/frameset.htm

what do you mean by correct path?

Thanks

Ami

Former Member
0 Kudos

Hi ami,

Oracle driver should be following syntax. check in your code.

For Oracle the JDBC connection URL syntax is:

- jdbc:<protocol>:<subprotocol>:<username>/<password>@<host>:<port>:<sid>

where

<protocol> = oracle

<subprotocol> = thin (this is the Oracle pure Java driver that is portable)

<username> = the database account name to use when establishing a connection

<password> = the password of the account name to use when establishing a connection

<host> = the fully qualified domain name or IP address of the database machine

<port> = the port the machine is listening for connections on (TNS Listener)

<sid> = the database name/instance to connect to

For Example:

jdbc:oracle:thin:system/manager_server1.sample:1521:sdn

Regards,

P.Manivannan

0 Kudos

Thnaks P.Manivannan for reply.

I'll explain my situation better,

I've imported the local WD project (That is already working fine) to WD DC, so the code is the same, its working fine in local project.

the problems begins within the DC project. I guess its related to appropriate configuration (extreanl library with the jar file),

even though I've done this I guess I'm still missing something.

Any idea will be appriciated.

Thanks

Ami

Former Member
0 Kudos

Hi ami,

Are you connect oracle via EJB or directly used in your DC?

Regards,

P.Manivannan

0 Kudos

I'm not using EJB.

I connect directly from DC

Thanks

Ami

Former Member
0 Kudos

Hi ami,

Directly connect oracle in WD is not a advisable.better u connect the oracle via EJB.

According to MVC architecture all business logic will be implemented into the EJB part then u can get into the EJB reference(sap.com/<your ear file name without extension>)

after getting the reference from EJB(ear file) then only that "suitable driver" exception will be removed

you can refer the following link

https://wiki.sdn.sap.com/wiki/display/WDJava/OracleConnectivitywithEJBusingWebDynproApplication

Regards,

P.Manivannan

0 Kudos

Thanks P.Manivannan

I know It will be beter to do it using EJB.

But I thought trying to do currently directly from DC.

is it not some configuration I need to apply in order for this to work?

If not, I guess I need to have first have the EJB.

Thanks

Ami

Former Member
0 Kudos

Hai ami,

If u want directly connect with Oracle DB to WebDynpro DC you can paste classes12.jar file in lib folder(C:\Documents and Settings\Documents\SAP\workspace\<your project>\lib) under your project worlspace.

Hope it will work.

Regards,

P.Manivannan.