cancel
Showing results for 
Search instead for 
Did you mean: 

Problem creating repository session

Former Member
0 Kudos

Hi

I am trying to run the following code which bombs out with the message <i>The MDM repository is invalid.</i> when <i>repositorySessionCmd.execute();</i> is called. Any help greatly appreciated. Here is the code:

public void createRepositorySession(RepositoryIdentifier repId) {
		
		CreateRepositorySessionCommand repositorySessionCmd = 
			new CreateRepositorySessionCommand(this.pool);
			
		repositorySessionCmd.setRepositoryIdentifier(repId);
		try {
			trace.debugT("executing RepositorySessionCommand with rep id "{0}" ...",
				new Object[]{repId.getName()});
			repositorySessionCmd.execute();
			trace.debugT("Execution of RepositorySessionCommand successful.");
		} catch (CommandException e) {
			String errMsg = "Could not create a repository session for rep id: " +
				repId.getName(); 
			trace.traceThrowableT(Severity.ERROR, errMsg, e);
			throw new RuntimeException(errMsg, e);
		}

with RepositoryIdentifier being:

RepositoryIdentifier repId = new RepositoryIdentifier(
				"DOL",
				"127.0.0.1",
				"MS_SQL");

Thanks

Paul

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

You have to use static constant to specify the type of database server.

import com.sap.mdm.server.DBMSType;

public static RepositoryIdentifier getRepositoryIdentifier(){

return new RepositoryIdentifier("Ads", "fsclxthiagaa", <b>DBMSType.MS_SQL</b>);

}

Message was edited by:

Adhappan Thiagarajan

Former Member
0 Kudos

Hi Adhappan

Thanks - I actually was doing that, just forgot to put it in the code example when posting. I seem to have solved this issue by replacing the "127.0.0.1" with my laptop's name (JNBN11039415A). MSSQL seems to list host name rather than ip address.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Paul,

Thanks for the detailed response to my query. I could solve that problem.

Thanks,

Guru

Former Member
0 Kudos

Hi Paul,

I have specified the fully qualified name of the MDM server, MDM repository and the static DBMSType but still I am getting the "Invalid MDM Repository". Could you tell me what else you did to make your application work ?

Thanks in advance..

Regards,

Guru

Former Member
0 Kudos

Hi Guru

These are the utility methods I am using:

	static ConnectionAccessor getConnection() throws ConnectionException {
		ConnectionAccessor connection = null;
		
		connection = ConnectionPoolFactory.getInstance(props.getProperty("serverTag"));
		return connection;
	}

	static private RepositoryIdentifier getRepositoryIdentifier() {
		return new RepositoryIdentifier(props.getProperty("repositoryName"), props.getProperty("serverTag"), DBMSType.MS_SQL);
	}


	static private String getRepositorySessionTag(ConnectionAccessor connection) throws CommandException {
		String repositorySessionTag = null;
		
		CreateRepositorySessionCommand cmd = new CreateRepositorySessionCommand(connection);
		RepositoryIdentifier repID = getRepositoryIdentifier();
		cmd.setRepositoryIdentifier(repID);
		cmd.execute();
		
		repositorySessionTag = cmd.getRepositorySession();
		
		return repositorySessionTag;
	}

Where (in my case) <b>props.getProperty("serverTag")</b> = JNBN11039415A (ie fully qualified server name) and <b>props.getProperty("repositoryName")</b> = DOL (ie the value in the "Name" field under "Repository Detail" in MDM Console.