After a long pause I am writing a technical article on Connecting Documentum Docbase with a Java Code.
Would not speak much and start with the code directly.But here I will assume that you know the basics of Documentum, have the DFC installed in your windows system in c:\Program Files\Documentum folder. In case you want to know the basics or trying to figure out about the DFC classes or any dumb question you have in your mind just shoot me a mail(escortnotice@gmail.com) or raise a question in this post.I will definitely try to help.
IDE used – Eclipse
Additiona Jars needed:- Give the path of all the jars in (C:\Program Files\Documentum\Shared) folder.
Code:- It will connect to the docbase and return a message on successful connection.
import com.documentum.com.IDfClientX;
import com.documentum.fc.client.DfClient;
import com.documentum.fc.client.IDfClient;
import com.documentum.fc.client.IDfCollection;
import com.documentum.fc.client.IDfQuery;
import com.documentum.fc.client.IDfSession;
import com.documentum.fc.common.DfException;
import com.documentum.fc.common.DfLoginInfo;
import com.documentum.fc.common.IDfLoginInfo;
public class DocbaseConnect {
IDfSession session;
IDfLoginInfo login;
IDfClient client;
IDfClientX clientx;
private static final String DOCBASE=”MYDOCS”;
private static final String UID=”User123″;
private static final String PASSWORD=”Password123″;
IDfQuery query;
IDfCollection col;
public void ConnectDocbase()
{
try {
/* will help to see the registered path variables with windows in case of error “java.io.FileNotFoundException: Cannot locate file – dfc.properties”*/
System.out.println(“Classpath:”+System.getProperty (“java.class.path”));
client=DfClient.getLocalClient();
login=new DfLoginInfo();
login.setUser(UID);
login.setPassword(PASSWORD);
session=client.getSharedSession(DOCBASE, login, DOCBASE+UID);
if (session.isConnected())
System.out.println(“Connected to Docbase”);
} catch (DfException e) {
e.printStackTrace();
}
}
}
Now most of you might get the below error:-
“Exception in thread “main” java.lang.Error: Failed to load preferences: java.io.FileNotFoundException: Cannot locate file – dfc.properties”
If this is the case then that means your environment variable C:\Documentum\config is not set which has the dfc.properties. If it is set and still you get the error then just check out the Console message that you have printed for the environment variables registered.I am sure you won’t see it. Below is the step you must do.
> Right click on Project you have created for this
> Project->Properties->Java Build Path-> Select the Libraries tab->Click on Add Class Folder from right panel->Create New Folder->Advanced->Link to the folder in the system->browse to the path c:\Documentum\Config.
For me the Documentum Folder is in C:\. You need to identify for you what is it and give that path.
Then run the file and I hope it will connect to your docbase.
Try Coding and Try it till it runs successfully……….
mohit singh – i wanted to connect to documentum from internet where documentum is residing somewhere on other server .i will need a dfc.jar and other files for creating tht connection how to get those from where exactly ?
mohit singh – i wanted to connect to documentum from internet where documentum is residing somewhere on other server .i will need a dfc.jar and other files for creating tht connection how to get those from where exactly ?
First you need to install DFC(DOcumentum foundation classes). You can download dfcWinSuiteSetup.exe. This is for windows environment. this will create a dfc environment. just like installing JRE creates a environment. You can then connect to the Documentum server using the dmcl.ini file. To access this file go to Run and type dmcl.ini a file will come up. There you need to mention the docbroker name and port. This file actually tells your client where the docbase is and how to connect it using which port.
@Mohit– check your mail.
a big thanks for ur reply … just a small query -check ur mail .
so need ur help .
i am trying to download a file from documentum . which is on some server as i said and then i will download the file for example x .pdf and download it on my machine where the code is running.this is the whole problem to say exactly .i am new to this documentum thing
after downloading this is done i will be maupulating the pdfs like mergering etc etc .. which i have already done so not a problem its the downloading thing which i am not able to get ..