cancel
Showing results for 
Search instead for 
Did you mean: 

Remote JDBC Connection Error

Former Member
0 Kudos

Hi

I am using from main() method to access jdbc.

Lookup is successful but I got the following error after that

My Code Snippet

Properties jndiCtxProp = new java.util.Properties();
						jndiCtxProp.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl" );
						jndiCtxProp.put(Context.PROVIDER_URL, "host:port");
			jndiCtxProp.put(Context.SECURITY_PRINCIPAL, "login");
				jndiCtxProp.put(Context.SECURITY_CREDENTIALS, "password");
			Context initCtx = new InitialContext(jndiCtxProp);
			DataSource dataSource =
				(DataSource) initCtx.lookup("jdbc/FLIGHTDATA");
			System.out.println("nFLIGHTDATA lookup successn"); //no problem upto this	
			conn = dataSource.getConnection();

I have used the following JAR's

logging.jar

sapj2eeclient.jar

exception.jar

jdbc20.jar

jta.jar

connector.jar

opensql.jar

opensqlapi.jar

opensqlcore.jar

sqljapi.jar

tc_sec_secstorefs.jar

Exception chain is

com.sap.engine.services.dbpool.exceptions.BaseSQLException: ResourceException in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.dbpool.exceptions.BaseResourceException: SQLException thrown by the physical connection: com.sap.sql.log.OpenSQLException: Could not instantiate class com.sap.sql.connect.OpenSQLDataSourceImpl.

at com.sap.engine.services.dbpool.cci.ConnectionFactoryImpl.getConnection(ConnectionFactoryImpl.java:59)

at com.ibm.training.carrier.dbload.JDBCLoader.getConnect(JDBCLoader.java:63)

at com.ibm.training.carrier.dbload.JDBCLoader.doLoad(JDBCLoader.java:29)

Thanks

Ananda

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
Former Member
0 Kudos

Hi Nigarajan

Thanks for the link, but it doesn't throw any light on my problem.

Any other link you have...

Regards

Ananda

Former Member
0 Kudos

Hi anand,

Is it not throwing u any error after u give catch statement also?

<b>try()

{

coding for DB

}

catch(Exception e)

{

wdComponentAPI.getMessageManager.raiseException("Exception :" +e);

}</b>

Even this din work?

http://help.sap.com/saphelp_erp2005/helpdata/en/de/7d77f8714b4ef080f2219d7d968008/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/70/a19cc472e72c4481172909938578fc/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/91/ccbf560ecc4e2fb99b09a5e7bce95e/frameset.htm

Hope this helps u,

Regards,

Nagarajan.

Answers (3)

Answers (3)

katarzyna_fecht
Explorer
0 Kudos

Hi,

as on any j2ee server, the proper way to obtain datasources and connections is to look them up via jndi interfaces, as described in the NW documentation:

http://help.sap.com/saphelp_erp2005/helpdata/en/b5/0cb8359ae4ad4387b38d866801690f/frameset.htm

Why do you instantiate the data source in a remote client?

Do you simply run tests? Anyway, this does not really make sense. Use server side components for this, for example servlet/jsp pages for tests.

good luck, Katharina

Former Member
0 Kudos

>Do you simply run tests? Anyway, this does not really make sense. Use server side components for this, for example servlet/jsp pages for tests.

There are any J2EE Server support remote lookup for DataSource. Except SAP J2EE? Why?

Former Member
0 Kudos

Hi !

The first thing you might want to do is check where the DataSource is bound to JNDI. There are views to the JNDI-tree NOT accessible from the outside (in terms of a seperate process).

AFAIK you have a global namespace accessible from the outside, a java:/ namespace accessible only from the app-server itself and a java:comp/env namespace accessible only from the component deployed.

If bound to java:/ namespace you have to lookup from something within a deployment (write a simple Servlet if u just want to test it)

Regards

Matthias

former_member441228
Active Participant
0 Kudos

OpenSQL in stand-alone mode is not supported but can only be run in the 6.40 (and higher) SAP WebAS.

Former Member
0 Kudos

Thanks for the information but can you give any supporting document eg url link for the same.

Regards

Ananda

former_member441228
Active Participant
0 Kudos

What are you trying to do? And it what context? Stand-alone code? WebAS? WebSphere?

Former Member
0 Kudos

Hi Ananda,

You should check in your server log file to see if it has anything interesting to say about this failure. What authentication method are u using /crypt/password/...)? The driver shouldn't be bailing out with

an error like that, but it is unclear where the actual problem is. so it would be helpful if you downloaded the lastest version of the driver.

http://jdbc.postgresql.org/download.html#jars

Regards,

Nagarajan.