cancel
Showing results for 
Search instead for 
Did you mean: 

JCO Connection Question:

Former Member
0 Kudos

Hello,

Using the Sample App. below I can connect to SAP and display the connection informations. My question is how could I know from the SAP System that I have connected. The Reason is that the Basis Admin doesn't accept/ aggree that I have connected b/c he can't see my user id like some one who connected into SAP from SAP using "SM58 transaction".Is there any explaination why the Basis Admin can't see that I have login and log out using the SSM58 Transaction?

I would appreciate all Help on this. Thanks.

import com.sap.mw.jco.*;

public class TestConnect {
	JCO.Client mConnection;
			
	public TestConnect() {
		try{
			mConnection = JCO.createClient("00",//SAP Cleint
				"test",//userid
				"test",//password
				"EN",//language
				"test",// server host name
				"00");// system number
				mConnection.connect();
			System.out.println(mConnection.getAttributes());
			mConnection.disconnect();
		}
		catch (Exception ex){
			ex.printStackTrace();
			System.exit(1);
		}
	}
	
	public static void main(String args[]) {
		TestConnect app = new TestConnect();
	}
}

Accepted Solutions (0)

Answers (3)

Answers (3)

ilja_farber
Employee
Employee
0 Kudos

SAP Note 766185

Symptom

You need explanation how to install SAP Java Connector 2.x

Other terms

JCo, SAp Java Connector, installation guide, installation

Reason and Prerequisites

Installation of SAP Java Connector 2.x

Solution

Preliminaries

The SAP Java Connector (JCo) @release@ requires a Java Runtime Environment (JRE) version 1.3 or higher. The 64-bit JCo versions need atleast a 64-bit JRE version 1.4. Additionally, an RFC runtime library version 6.20 or higher must be installed on the system on which you would like to run JCo. A sufficient version of the RFC library is already shipped with this distribution package but you may also downloada newer one from http://service.sap.com/patches

The latest version of the SAP Java Connector can be downloaded from the SAP Service Marketplace at http://service.sap.com/connectors. There you will also find all available distribution packages for the various supported platforms and processors.

<b>Windows NT, Windows 2000 and Windows 2003</b>

There are different distribution packages for various JRE versions and hardware processors available:

sapjco-ntintel-xxx.zip for a 32-bit JRE running on a 32-bit INTEL x86 or a 64-bit INTEL Itanium processor

sapjco-ntia64-xxx.zip for a 64-bit JRE running on a 64-bit INTEL Itanium processor

To install JCo for Windows unzip the appropriate distribution package

into an arbitrary directory {sapjco-install-path}.

If you already have an older librfc32.dll in the {windows-dir}\system32

directory, please replace it with the one that comes with JCo.

<b>Then add {sapjco-install-path} to the PATH environment variable.</b>

Finally, add {sapjco-install-path}\sapjco.jar to your CLASSPATH

environment variable.

Linux

There are different distribution packages for various JRE versions and hardware processors available:

sapjco-linuxintel-xxx.tgz for a 32-bit JRE running on a 32-bit INTEL x86 processor

sapjco-linuxia64-xxx.tgz for a 64-bit JRE running on a 64-bit INTEL Itanium processor

sapjco-linuxs390x-xxx.tgz for a 64-bit JRE running on a 64-bit IBM eServer zSeries processor

To install JCo for Linux copy the appropriate distribution package into an arbitrary directory {sapjco-install-path}. Next, change to the directory:

cd {sapjco-install-path} [return]

and extract the archive:

tar zxvf sapjco-linux*.tgz [return]

Then add {sapjco-install-path} to the LD_LIBRARY_PATH environment variable

Finally, add {sapjco-install-path}/sapjco.jar to your CLASSPATH environment variable.

SUN Solaris

There are different distribution packages for various JRE versions and

hardware processors available:

sapjco-sun-xxx.tgz for a 32-bit JRE running on a 32- or 64-bit SUN SPARCprocessor

sapjco-sun_64-xxx.tgz for a 64-bit JRE running on a 64-bit SUN SPARC processor

To install JCo for SUN Solaris copy the appropriate distribution package

into an arbitrary directory {sapjco-install-path}. Next, change to the

installation directory:

cd {sapjco-install-path} [return]

and extract the archive:

gunzip sapjco-sun*.tgz [return]

tar xvf sapjco-sun*.tgz [return]

Then add {sapjco-install-path} to the LD_LIBRARY_PATH environment variable

Finally, add {sapjco-install-path}/sapjco.jar to your CLASSPATH environment variable.

IBM AIX

There are different distribution packages for various JRE versions and hardware processors available:

sapjco-rs6000-xxx.tgz for a 32-bit JRE running on a 32- or 64-bit IBM RS/6000 processor

sapjco-rs6000_64-xxx.tgz for a 64-bit JRE running on a 64-bit IBM RS/6000 processor

To install JCo for IBM AIX copy the appropriate distribution package an arbitrary directory {sapjco-install-path}. Next, change to the installation directory:

cd {sapjco-install-path} [return]

and extract the archive:

gunzip sapjco-rs6000*.tgz [return]

tar xvf sapjco-rs6000*.tar [return]

Then add {sapjco-install-path} to the LIBPATH environment variable.

Finally, add {sapjco-install-path}/sapjco.jar to your CLASSPATH

environment variable.

HP-UX

There are different distribution packages for various JRE versions and

hardware processors available:

sapjco-hp_32-xxx.tgz for a 32-bit JRE running on a 32- or 64-bit PA-RISC processor

sapjco-hp_64-xxx.tgz for a 64-bit JRE running on a 64-bit PA-RISC

sapjco-hpia64-xxx.tgz for a 64-bit JRE running on 64-bit INTEL Itanium processor

To install JCo for IBM AIX copy the appropriate distribution package into an arbitrary directory {sapjco-install-path}. Next, change to the installation directory:

cd {sapjco-install-path} [return]

and extract the archive:

gunzip sapjco-hp*.tgz [return]

tar xvf sapjco-hp*.tar [return]

Then add {sapjco-install-path} to the SHLIB_PATH environment variable.

Finally, add {sapjco-install-path}/sapjco.jar to your CLASSPATH environment variable.

HP Tru64

There is only one distribution package available for running JCo in a a 64-bit JRE on a 64-bit DEC Alpha processor.

To install JCo for HP Tru64 copy the distribution package sapjco-alphaosf-xxx.tgz into an arbitrary directory {sapjco-install-path}. Next, change to the installation directory:

cd {sapjco-install-path} [return]

and extract the archive:

gunzip sapjco-alphaosf-*.tgz [return]

tar xvf sapjco-alphaosf-*.tar [return]

Then add {sapjco-install-path} to the LD_LIBRARY_PATH environment variable

Finally, add {sapjco-install-path}/sapjco.jar to your CLASSPATH environment variable.

Apple Mac OS X, Version 10.3.1

There is only one distribution package available for running JCo in a 32-bit PowerPC G3/G4 or a 64-bit PowerPC G5 processor.

To install JCo for Apple Mac OS X copy the distribution package sapjco-darwin-xxx.tgz into an arbitrary directory {sapjco-install-path}. Next, change to the installation directory:

cd {sapjco-install-path} [return]

and extract the archive:

gunzip sapjco-darwin*.tgz [return]

tar xvf sapjco-darwin*.tar [return]

Then add {sapjco-install-path} to the DYLD_LIBRARY_PATH environment variable

Finally, add {sapjco-install-path}/sapjco.jar to your CLASSPATH environment variable.

IBM OS/400

There is only one distribution package available for running JCo in a

64-bit IBM AS/400 processor.

Prerequisite: Product 5722SS1 option 33 (OS/400 Portable Application

Solutions Environment) must be installed.

To install JCo for IBM OS/400, unzip the file sapjco-as400_pase_64-xxx.zip into an arbitrary directory {sapjco-install-path} on the IFS file system.

Next, go to the iSeries command prompt and change to the installation directory:

cd {sapjco-install-path} [return]

Then add {sapjco-install-path} to the LIBPATH environment variable:

ADDENVVAR ENVVAR(LIBPATH) VALUE('{sapjco-install-path}') [return]

Furthermore, add {sapjco-install-path}/sapjco.jar to your CLASSPATH environment variable:

ADDENVVAR ENVVAR(CLASSPATH) VALUE('{sapjco-install-path}/sapjco.jar')

[return]

To use OS/400 PASE native methods when starting Java from an iSeries

command prompt or Qshell command prompt, set the QIBM_JAVA_PASE_STARTUP

environment variable:

ADDENVVAR ENVVAR(QIBM_JAVA_PASE_STARTUP) VALUE('/usr/lib/start64')

[return]

IBM z/OS

There is only one distribution package available for running JCo in a 32-bit JRE on IBM's z/OS operating system.

Prerequisite: The utility gzip is required to extract the package file. It can be downloaded from

http://www-1.ibm.com/servers/eserver/zseries/zos/unix/bpxa1toy.html

Prerequisite: IBM's latest patches for LibASCII support (fomeliba.dll) must be installed (IBM APAR OW57148).

To install JCo for z/OS copy the distribution package

sapjco-os390-xxx.tgz into an arbitrary directory

{sapjco-install-path}. Next, change to the installation directory:

cd {sapjco-install-path} [return]

and extract the archive with implicite translation of text files to

EBCDIC:

gzip -d sapjco-os390-*.tgz [return]

pax -rvf sapjco-os390-*.tar -o from=ISO8859-1,to=IBM-1047

pax -rvf sapjco-os390-*.tar .jar lib //im/ //*.pdf

Then add {sapjco-install-path}:/usr/lpp/icli/sbin to the LIBPATH environment variable.

Finally, add {sapjco-install-path}/sapjco.jar to your CLASSPATH environment variable.

Former Member
0 Kudos

Hi,

I tried to use your code to connect to SAP and was unable in doing so. So , Can u clarify in this regard . Is this code alone enogh to connect to SAP or any thing should done first before executing this code .Can u help me in this regard. My problem is to connect to SAP from java .

And I donot have perfect ground of knowledge in this regard.

Thanks in advance

Former Member
0 Kudos

Hi,

please specify your problem. What does not work? Do you get an error / exception...? Are your writing a java standalone application or are you on portal, j2ee engine ...?

The code here should be fine, though all it does it a pure connect to an ABAP system, no functions called here so far.

Btw: There are numerous tutorials available for using JCo or alternative techniques for performing RFC calls - have you already taken a look at them?

Regards,

Dominik

Former Member
0 Kudos

Hi Dominik Witte,

I used the said code in a standalone java program .

And copied that code into a file and compiled and found no errors here. And when I execute the code I get this excepetion . My basic intention is to connect to SAP system here and making an ABAP program to execute .

For that I did not go through any help yet and as a beginning of this process I was going through the FORUM .

Exception in thread "main" java.lang.ExceptionInInitializerError: JCO.classIniti

alize(): Could not load middleware layer 'com.sap.mw.jco.rfc.MiddlewareRFC'

JCO.nativeInit(): Could not initialize dynamic link library sapjcorfc [no sapjco

rfc in java.library.path]. java.library.path [C:\WINDOWS\system32;.;C:\WINDOWS\s

ystem32;C:\WINDOWS;E:\oracle\ora90\bin;C:\PROGRA1\Oracle\jre\112ECD1.8\bin;C:\

WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;c:\java\bin;c:\java\lib;.]

at com.sap.mw.jco.JCO.<clinit>(JCO.java:735)

at TestConnect.<init>(TestConnect.java:8)

at TestConnect.main(TestConnect.java:25)

Former Member
0 Kudos

Thanks for the response here.

I had got the solution for that . I did not place sapjcorfc.dll and librfc32.dll in windows\system32 folder and when I placed the same there the problem was solved .

I would be happy If u can provide some locations where I can find the effective help docs in this regard .

Former Member
0 Kudos

Rudolph,

i'm no SAP basis expert, but isn't SM58 only for tRFCs? (i.e. transactional RFC calls)?

As you have neither

- performed a tRFC call nor

- called any function module

I would not expect to see anything in SM58.

If your basis guy does not believe you, tell him he should go to SM50 and active security tracing on some od the DIA work processes. Then he should clearly see your successful logon attempts.

Hope this helps you. If you, don't forget the points and mark this question as answered. Otherwise, please com back and post feedback.

Regards,

Dominik

Former Member
0 Kudos

Hello Dominik,

Thanks for your respond. Actually I found the Transaction which does indeed show the log in inoformation ie RFCPING. It's not the SM50. SM50 does not show the RFC PING.You're looking for when you ping the SAP System.

Message was edited by: Rudolph Emange