cancel
Showing results for 
Search instead for 
Did you mean: 

Exception while connecting to Oracle

Former Member
0 Kudos

Hi all ,

I have a requirement to connect to an Oracle database from a portal component . I have created a driver in the j2ee engine's Visual Administrator and configured a data source for this driver called OracleDataSource . I wrote a simple AbstractPortalComponent whose code is given below . I am facing the following exception . Any pointers to what needs to be done ?

Exception is :

<b>Context found datasourceResourceException in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: com.sap.sql.log.OpenSQLException: JDBC driver not supported for ORACLE database.</b>

The code is :

package com.itc.taz;
 
import java.sql.Connection;
 
import javax.naming.InitialContext;
import javax.sql.DataSource;
 
import com.sapportals.portal.prt.component.AbstractPortalComponent;
import com.sapportals.portal.prt.component.IPortalComponentRequest;
import com.sapportals.portal.prt.component.IPortalComponentResponse;
 
public class OraConnection extends AbstractPortalComponent
{
    public void doContent(IPortalComponentRequest request, IPortalComponentResponse response)
    {
    	try{
    		InitialContext ctx = new InitialContext();
			if(ctx == null)
						{
							response.write("Context couldn be found");
						}
						else{
							response.write("Context found");
						}
    		DataSource dataSource = (DataSource)ctx.lookup("jdbc/OracleDataSource");
    		if(dataSource == null)
    		{
    			response.write("DataSource couldn be found");
    		}
    		else{
    			response.write(" datasource");
    		}
    		Connection con = dataSource.getConnection();
    		if(con == null)
    		{
    			response.write("Connection not obtained");
    		}
    		else{
    			response.write("Connection success");
    		}
    	}
        catch(Exception e)
        {
        	response.write(e.getMessage());
        }
    }
}

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Network adapter could not establish the connection means that either db is down, or the configuration in the datasource you have created for connecting to the database is wrong.

You can test directly from dbpool service whether the datasource works correctly via the j2ee engine telnet command test_ds, see:

http://help.sap.com/saphelp_nw2004s/helpdata/en/06/37c8886ccd4759ae64ba831431864a/content.htm

Regards, Myriana

Former Member
0 Kudos

Please pardon me the exception that I am getting now is

<b>Context found datasourceResourceException in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection</b>

Former Member
0 Kudos

This error is connected with Oracle DB directly not with SAP. Try this links:

http://www.orafaq.com/forum/t/35144/0/

http://www.dbforums.com/showthread.php?t=485185

and use Google if above links does not solve your problem.

Regards,

Marcin Zduniak