Skip to Content

How know by CODE the dataresource name, from SDM?

Usually i do:

		String datasource_name = 
					"jdbc/SAP" + 
						(String) System.getProperties().get("SAPSYSTEMNAME")
								+ "DB";
		String contextUrl = "";
		String contextFactory = "com.sap.engine.services.jndi.InitialContextFactoryImpl";
		Properties properties = new Properties();
		properties.put("java.naming.factory.initial", contextFactory);

		ctx = new InitialContext(properties);
		ds = (DataSource)ctx.lookup(datasource_name);
		con = ds.getConnection();

But sometimes administrator don´t use the rule to put the ResourceName like "SAP is the system ID of SAP instance.

I am developing for DEV environment and have a specific datasource name, but after the track transport i will have for quality environment another datasource name, and the same will happen for production.

Any idea on how to realize a flexible solution CODE that can work for all environment?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Nov 15, 2006 at 02:19 PM

    Hi,

    Why can't you use .peoperties file in your project .?

    Check this Using .properties file in web dynpro

    Regards, Anilkumar

    Add comment
    10|10000 characters needed characters exceeded