Sample java code to obtain data from ALUI directory
Hi
I need to go to the ALUI LDAP ( directory ) services to get user profile information.
The documentation did not help me to figure out the way to obtain data from it.
so , it would be a great help if some one could share the sample java code api to obtain data from ALUI directory.
i'm guessing you are asking to get the groups for a particular user. someone in the other thread posted the actual SQL, that may be easier. ( you are on 10gR3 right, because ALUI directory didn't exist before 6.5)
I dont have a sample done yet, but the internet is filled with samples of java and ldap...
http://www.coderanch.com/t/133108/Security/LDAP-sample-program
Similar Messages
-
Need Sample code to retrieve Data from Portal DB(Oracle)
Would anyone provide me steps to create application with a sample code to retrieve data from portal DB which is oracle and see the output in table format.
Hi Bris ,
The sample code , you didnt specified from where do u want to access the oracle thorough java code or through webdynpro .
Sample code to access through Java
import java.sql.*;
class Customer
public static void main(String args[]) throws SQLException
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
System.out.println("Connecting to the database...");
try
Connection cn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","t");
Statement st=cn.createStatement();
ResultSet rs=st.executeQuery("select 'Connected' from dual");
rs.next();
String s=rs.getString(1);
System.out.println(s);
st.close();
cn.close();
catch(Exception ex)
System.out.println("The exception raised is:" + ex);
[code]
If accessing through JDBC datasorce.
https://www.sdn.sap.com/irj/sdn/thread?threadID=328550
https://www.sdn.sap.com/irj/sdn/thread?threadID=309386
[code]
package com.dhl.employeemodel;
import java.sql.Connection;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;
public class DBConnectionManager {
Connection connection;
* @return
public Connection getConnection() {
try
Context jndiContext = new InitialContext();
DataSource ds = (DataSource)jndiContext.lookup("jdbc/MyAlias");
connection = ds.getConnection();
catch(Exception connectionErrEx)
//connectionErrEx.printStackTrace();
return null;
return connection;
Thanx
Pankaj -
Sample Java code and detail to call RFC from Java clas developed in Eclipse
Hi All,
I am new to Java. I have downloaded Eclipse IDE and planning to use for developing Java application to send data to SAP by calling RFC JCO Interface.
I need a sample java code/tutorial step by step to create Java class for simple example to call RFC from Java.
I have downloaded SAPJCO3 from service market place.
Kindly help me to send steps involved to configure for JCO with my Eclipse with JCO.
Thanks in advance.
SharmaHi Sharma,
Please have a look at [Example: Using Generated Proxies to Call Function Modules |http://help.sap.com/saphelp_nw04/helpdata/en/b6/55e3952a902447847066a0df27b0d6/content.htm]
JCo Exceptions : http://help.sap.com/saphelp_nw70ehp1/helpdata/en/f6/daea401675752ae10000000a155106/content.htm
Hope it will helps
Regards
Arun -
Sample Java Code to send an HTML mail with embeded image
Hello,
Please can I get a sample Java code on sending an HTML mail with embeded image.
The HTML message and relevant input parameters withhbe supplied from a PL/SQL that will call the class , the class will embed the image and send the mail to the recepient.tev wrote:
Please can I get a sample Java codeNo. This is a forum, not a code mill.
Recommended reading: How to ask questions the smart way
db -
T code to Copy Data from one table to another table
Hi,
I want copy all data of one table to its copy table. Anyone knows transaction code to copy data from one table to another table.
Regards,
Jigar Thakkar.Hi
Create a small program.
Extract data from T1 - database table and put it in one internal table - itab1.
loop the itab1 data .............
insert itab1 into tab2. (tab2 - second database table)
endloop.
try this....
hope it works.... -
Migration of data from Netscape-Directory 4.1 to Sun Java System DS 5.2P6
Hi all,
I am in the process of migrating data from Netscape-Directory/4.1 B99.166.1013 to Sun Java(TM) System Directory Server/5.2_Patch_6 B2007.221.1746
and I am new to this environment.
please help me to to migrate only the data as we built DS5.2P6 on a new Hardware.
Thanks,
SridharFirst, thank for the answer.
I tried,
but Netscape and JES PAB are quite different.
This is an entry Netscape:
dn: cn=170695183, ou=testcomune, o=pab
mail: [email protected]
givenName;lang-it: Plutarco
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: pabperson
cn;lang-it: Plutarco Plutone
memberofpab: 117080712
sn;lang-it: Plutone
cn: 170695183
And this is an entry JES:
dn: un=ziopinoc6173be, ou=testcomune, o=pab
mail: [email protected]
un: ziopinoc6173be
givenName: zio
objectClass: top
objectClass: person
objectClass: organizationalPerson
objectClass: inetOrgPerson
objectClass: pabperson
sn: pino
cn: zio pino
As you see, in dn JES appear un instead of cn.
Attributes are little different.
Really, in JES Communication Express I can see also the old entry of pab. But I can't edit them by click to "Display Name": all field appear empty in the opening window.
So, I think two operation are needed:
1) a script that modify attributes from netscape pab to JES pab.
2) when I add a JES account, the pab is added in a tree that is not the netscape pab. The autocreate netscape pab was:
ou=<uid>,o=pab
the autocreate JES pab is:
ou= <tree_of_account_on_his_root>,ou=<uid>,o=pab
To avoid confusion, I would like keep old tree style also for new account without change it by hand in paburi attribute.
Is that possible?
Thank you very much again
Marco -
Hi,
iam working in SAP .
I need sample java code on how to convert Decimal to number
For Ex: I/p-----123.11
O/p----------------12311 ( with out decimal) want to remove the dicimal point what ever the input value and deliver it to the output
Please give me code
Regards
Sumani don't know what do you want to do really. If you are doing it simply then you can take the input in a String and then remove the decimal.
String str = "123.11";
str = str.substring(0, str.indexOf("."));
System.out.println(str); -
Sample java code which reads xml attributes using DOM Parser
Hi Friends,
I am looking for a sample java code which uses the DOM Parser to read the attributes values.
My xml looks like below
<?xml version='1.0' encoding='UTF-8'?>
<root>
<header unid="100" status="true">
<validation stage="1" processed="10"/>
</header>
</root>
Experts please help...
Thanks in Advance
JJYou have probably found lots of resources on the www for this by now, if not: [http://www.w3schools.com/dom/default.asp|http://www.w3schools.com/dom/default.asp]
-
Attempt to fetch cache data from Integration Directory failed
HI,
while checking cache connectivity testing: status is
green: Integration Repository
green: Integration Directory
green: Integration Server - JAVA
red:Adapter Engine af.axd.aipid
yello:Integration Server - ABAP
Jun 30, 2007 1:16:08 PM - Cache notification from Integration Directory received successfully
Attempt to fetch cache data from Integration Directory failed; cache could not be updated
[Fetch Data]: Unable to find an associated SLD element (source element: SAP_XIIntegrationServer, [CreationClassName, SAP_XIIntegrationServer, string, Name, is.00.aipid, string], target element type: SAP_BusinessSystem)
[Data Evaluation]: GlobalError
what to do?
and there is nothing under integration server and integration engine but there is an green status under Non-Central Adapter Engines > from this i am doing send messeage testing fro xi to bi ,
send message to: http://aibid:8000/sap/xi/engine?type=entry
payload:
<?xml version="1.0" encoding="utf-8"?>
<ns1:MI_VCNdatatoBI
xmlns:ns1="http://bi.sap.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance">
<DATA>
<item>
</BIC/ZG_CWW010>1000<//BIC/ZG_CWW010>
</BIC/ZVKY_CHK>1<//BIC/ZVKY_CHK>
</item>
</DATA>
</ns1:MI_VCNdatatoBI>
i can sent message from there (component monitoring > Non-Central Adapter Engines) but unable to get it at message monitoring and at BI side.
dushyant.thanks,
but i have adepter type XI
and i am folowing step of this lonk and there is no need to create fild adepter type according to that and almost done but while sending message through config. monitor in RWB it goes but not coming in mess monitoring and at bi side
see 4.5 > 3 and 4 topic and 4.6 > 3,4,5
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f027dde5-e16e-2910-97a4-f231046429f2
now what to do?
dushyant, -
UCCE Pulling Data from Active Directory
Greetings,
Is it possible to pull data from Active Directory using caller ANI, and then pass first name, last name, etc... to Finesse through call variables?
This is for an IT support line of business where callers are internal.
Either through ICM or CVP Studio application?
Thanks a lot,
MikeYou can write custom element in CVP, A Java class (Standard Action Element) which will connect to your Active Director using standard LDAP protocol and query information based on telephone number.
then put the data in some variable and pass it back to ICM.
look at this : http://docs.oracle.com/javase/tutorial/jndi/ops/index.html
Regards
Chintan -
How to obtain data from a device and display that data in an infinite loop
I'm trying to run an infinite loop where I'm testing a robot for thermal insulation.
I send the robot a command to run infinitely (using VISA communication)..., the robot starts running.
At the same time I obtain the temperature data from its motors (through sensors) and want to display it. The data should be refreshed at regular itervals but I only get broken display of the data at various instances of time during the robot's test-run.
I fear that there is a problem with the time synchronization. But having tried many permutations of time delays at various points in the program, I can not find the fault.
Any help is much appreciated.
Cheers
RajatWe really need screen shots (*png format/NOT .bmp!) or attached code to see what might be the problem. There are an infinite number of mistakes that can be made (or nearly so), depending on how a program is written.
Putnam
Certified LabVIEW Developer
Senior Test Engineer
Currently using LV 6.1-LabVIEW 2012, RT8.5
LabVIEW Champion -
FM code for extracting data from 10 tables
Hi All,
I have a requirement, where i need to extract the data from 10 tables using FM which is further used to create a data source in SAP R3.
The fields are almost similar in all the tables but yet i have to fetch the data from all the tables.
My approach:
1. I have created a structure with all the fields in it from all the tables that comes to 35 fields.
2. create a structure of each table and loop it into an internal table and work area.
3. writing a read statement based on a key value from all the work areas and populate the same into my final structure.
Note: there is a key field that need to be considered when updating the data into final stucture.
All help on the code / logic would be appreciated.
Thanks
Moderator message : Spec/requirements dumping not allowed, show the work you have already done. Thread locked.
Edited by: Vinod Kumar on Feb 28, 2012 8:35 PMHi All,
I have a requirement, where i need to extract the data from 10 tables using FM which is further used to create a data source in SAP R3.
The fields are almost similar in all the tables but yet i have to fetch the data from all the tables.
My approach:
1. I have created a structure with all the fields in it from all the tables that comes to 35 fields.
2. create a structure of each table and loop it into an internal table and work area.
3. writing a read statement based on a key value from all the work areas and populate the same into my final structure.
Note: there is a key field that need to be considered when updating the data into final stucture.
All help on the code / logic would be appreciated.
Thanks
Moderator message : Spec/requirements dumping not allowed, show the work you have already done. Thread locked.
Edited by: Vinod Kumar on Feb 28, 2012 8:35 PM -
Not able to checkout Files using Java Code and SAP BAPI from DMSServer
Hi
Able to download / checkout the files using T-Code SE37 (BAPI_DOCUMENT_CHECKOUTVIEW2).
But when same RFC is executed from Java, it alsways says -
Message ::::::::Document LGL/10000000003/000/00 does not exist
My inputs in Java Code is as below -
import java.io.*;
import java.util.*;
import com.sap.mw.jco.*;
//CREATED ON - 10-APRIL-2010.
public class BapiDocCheckOutview {
public static void main(String args[]){
try{
if(mConnection!=null){
JCO.Repository repository=new JCO.Repository("AraSoft",mConnection);
JCO.setMiddlewareProperty("jco.middleware.allow_start_of_programs", "SAPFTPA");
JCO.Function function=repository.getFunctionTemplate("BAPI_DOCUMENT_CHECKOUTVIEW2").getFunction();
//End of get function.
System.out.println("Before execution1");
if(function !=null){
JCO.Field DOCUMENTTYPE = function.getImportParameterList().getField("DOCUMENTTYPE");
DOCUMENTTYPE.setValue("LGL");
JCO.Field DOCUMENTNUMBER = function.getImportParameterList().getField("DOCUMENTNUMBER");
DOCUMENTNUMBER.setValue("10000000003");
JCO.Field DOCUMENTPART = function.getImportParameterList().getField("DOCUMENTPART");
DOCUMENTPART.setValue("000");
JCO.Field DOCUMENTVERSION = function.getImportParameterList().getField("DOCUMENTVERSION");
DOCUMENTVERSION.setValue("00");
JCO.Field GETSTRUCTURE = function.getImportParameterList().getField("GETSTRUCTURE");
GETSTRUCTURE.setValue("1");
JCO.Field GETCOMPONENTS = function.getImportParameterList().getField("GETCOMPONENTS");
GETCOMPONENTS.setValue("X");
JCO.Field ORIGINALPATH = function.getImportParameterList().getField("ORIGINALPATH");
ORIGINALPATH.setValue("C:
TEMP
DMS_");
JCO.Field GETHEADER = function.getImportParameterList().getField("GETHEADER");
GETHEADER.setValue("X");
JCO.Field PF_FTP_DEST=function.getImportParameterList().getField("PF_FTP_DEST");
PF_FTP_DEST.setValue("SAPFTPA");
//JCO.Field PF_HTTP_DEST=function.getImportParameterList().getField("PF_HTTP_DEST");
//PF_HTTP_DEST.setValue("SAPHTTPA");
System.out.println("Here Setting Values Inside Structure ::DOCUMENTFILE");
JCO.Structure DOCUMENTFILE=function.getImportParameterList().getStructure("DOCUMENTFILE");
DOCUMENTFILE.setValue("1","ORIGINALTYPE");
DOCUMENTFILE.setValue("WWI","WSAPPLICATION");
DOCUMENTFILE.setValue("ZHCL_CS","STORAGECATEGORY");
DOCUMENTFILE.setValue("E0DF7893E2BD5DF19C07001517B4A299","APPLICATION_ID");
DOCUMENTFILE.setValue("E0DF7893E2BD5FF19C07001517B4A299","FILE_ID");
DOCUMENTFILE.setValue("X","CHECKEDIN");
DOCUMENTFILE.setValue("X","ACTIVE_VERSION");
//DOCUMENTFILE.setValue("LGL","DOCUMENTTYPE");
//DOCUMENTFILE.setValue("10000000003","DOCUMENTNUMBER");
//DOCUMENTFILE.setValue("000","DOCUMENTPART");
//DOCUMENTFILE.setValue("00","DOCUMENTVERSION");
//JCO.Field GETCOMPONENTS = function.getImportParameterList().getField("GETCOMPONENTS");
//GETCOMPONENTS.setValue("X");
//JCO.Field GETHEADER = function.getImportParameterList().getField("GETHEADER");
//GETHEADER.setValue("X");
mConnection.execute(function);
If anyone have an Idea on what I have missed out...
Please do advice me.
Thanks
PrashantHi
To update in the initial requirement, I have added (prefixed, zeroes) in Document No., doing that, now the application is able to find the document, but not able to transfer the same from DMS Server to my local Machine, always giving the following error -
Type ::::::::E
Message ::::::::File d:\dms\z_IPI_PRASHANT01.doc cannot be created
Please let me know, if some services needed to checked in SAP System or some more information to be provided in RFC.
Thanks
Prashant
Dear Experts
Any advice on this. Still not able to download the documents from DMS Server.
I have also added few more code in my Java program -
private int use_sapgui;
public void setSapGui(int use_sapgui){
use_sapgui = 2;
PLease help !!
Regards
Edited by: Prashantroy on Sep 26, 2011 12:49 PM
Hi,
Further to my earlier Mail, while checking the Trace suing SM59 in ECC System I got the following Error -
Trace file opened at 20111010 142232 India Standard Time, SAP-REL 701,0,134
======> cannot open SAPGUI
ABAP Programm: SAPLSYSE (Transaction: )
User: IPI_PRASHANT (Client: 220)
Destination: SAPFTP (handle: 3, , )
SERVER> RFC Server Session (handle: 1, 43220900, {5D1DF3E0-ACBD-F11F-8EA0-00A0D1
SERVER> Caller host:
SERVER> Caller transaction code: (Caller Program: java)
SERVER> Called function module: RFC_START_PROGRAM
Error RFCIO_ERROR_SYSERROR in abrfcpic.c : 1742
FUNCTION: 'exec_sapgui'
cannot open SAPGUI
PROG =sapftp erpdev sapgw00 43232164 IDX=4
Can someone help me in getting this sorted out.
Thanks N Regards
Edited by: Prashantroy on Oct 10, 2011 2:32 PM -
WD Java - Showing Table with data from R/3 backend
hi folks,
i have a very novice question.
we have one rfc-function in abap which is called via adaptive rfc in wd java - it's mostly like the flights-demo.
I get the data from backend but only one row is shown in the table????
I guess i made everything correct like in the flights-demo, does anyone has a hint where the problem could be?
kind regards,
oliverHi there,
Where is the data source of your table bound to? Is it to the model node. Check the size() of that node after the bapi call(and invalidate() statement) to check whether data is actually being retrieved.
Regards,
LM -
How to compile connection pool sample java code
I recently bought David Knox's "Effective Oracle Database 10g Security by Design", and have been working through his examples with client identifiers and how to leverage database security with anonymous connection pools.
The database side of things I totally understand and have set up, but I now want to compile/run the java code examples, but don't know what is required to compile this.
I'm running Oracle 10.2.0.4 (64-bit) Enterprise Edition on a Linux (RHEL 5) PC. Java version is 1.6.0_20. Relevant .bash_profile environment variables are as follows:
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin
When I try to compile, I get:
oracle:DB10204$ java FastConnect.java
Exception in thread "main" java.lang.NoClassDefFoundError: FastConnect/java
Caused by: java.lang.ClassNotFoundException: FastConnect.java
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: FastConnect.java. Program will exit.
The java source code of one of the examples is below. Is someone able to point me in the right direction as to how I get this to compile? Do I just have a syntax and/or environment configuration modification to do, or is there more to it than that to get this example working? Any help much appreciated.
oracle:DB10204$ cat FastConnect.java
package OSBD;
import java.sql.*;
import oracle.jdbc.pool.OracleDataSource;
public class FastConnect
public static void main(String[] args)
long connectTime=0, connectionStart=0, connectionStop=0;
long connectTime2=0, connectionStart2=0, connectionStop2=0;
ConnMgr cm = new ConnMgr();
// time first connection. This connection initializes pool.
connectionStart = System.currentTimeMillis();
Connection conn = cm.getConnection("SCOTT");
connectionStop = System.currentTimeMillis();
String query = "select ename, job, sal from person_view";
try {
// show security by querying from View
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery(query);
while (rset.next()) {
System.out.println("Name: " + rset.getString(1));
System.out.println("Job: " + rset.getString(2));
System.out.println("Salary: " + rset.getString(3));
stmt.close();
rset.close();
// close the connection which resets the database session
cm.closeConnection(conn);
// time subsequent connection as different user
connectionStart2 = System.currentTimeMillis();
conn = cm.getConnection("KING");
connectionStop2 = System.currentTimeMillis();
// ensure database can distinguish this new user
stmt = conn.createStatement();
rset = stmt.executeQuery(query);
while (rset.next()) {
System.out.println("Name: " + rset.getString(1));
System.out.println("Job: " + rset.getString(2));
System.out.println("Salary: " + rset.getString(3));
stmt.close();
rset.close();
cm.closeConnection(conn);
} catch (Exception e) { System.out.println(e.toString()); }
// print timing results
connectTime = (connectionStop - connectionStart);
System.out.println("Connection time for Pool: " + connectTime + " ms.");
connectTime2 = (connectionStop2 - connectionStart2);
System.out.println("Subsequent connection time: " +
connectTime2 + " ms.");
}Code download is at: http://www.mhprofessional.com/getpage.php?c=oraclepress_downloads.php&cat=4222
I'm looking at Chapter 6.stuartu wrote:
When I try to compile, I get:
oracle:DB10204$ java FastConnect.java
Exception in thread "main" java.lang.NoClassDefFoundError: FastConnect/java
Caused by: java.lang.ClassNotFoundException: FastConnect.java
I will try to explain what is happening here.
You are launching java telling it to run a class named 'java' in a package named 'FastConnect'
and java says it cannot find that class.
What you intended to do:
$ # make the directory structure match the package structure
$ mkdir OSBD
$ # move the source file in the directory structure so it matches the package structure
$ mv FastConnect.java OSBD/
$ # compile OSBD/FastConnect.java to OSBD/FastConnect.class
$ javac OSBD/FastConnect.java
$ # launch java using the OSBD/FastConnect class
$ java -cp . OSBD.FastConnectNote that the package 'OSBD' does not follow the recommended naming conventions
you might consider changing that to 'osbd'.
Maybe you are looking for
-
Timeline. How does (or does not) update global variables?
Hello All, I am having problems to understand how a timeline updates values. In my case the timeline is supposed to change an index within a second always by incrementing it by one or decrementing by one. Basically I am trying to create a mosaic of i
-
Datagrid itemRenderer - Help needed
I am having trouble getting this little bit of code working. I am trying to build an adhoc SQL generator, where the user selects the list of fields and then is able to set the WHERE criteria in a dataGrid, each row has field, criteria (ComboBox -equ
-
Why is the iPad charging very slowly and not completely
The iPad recently has stopped holding its charge and is charging very very slowly--even after being plugged in overnight it is only half charged. I did just download the upgrade and am wondering if that could have something to do with it?
-
Upgraded from 10.6 to 10.6.2, network stopped working on an iMac.
Went to the Apple store yesterday, bought Snow Leopard. Installed it, everything seemed to work fine at 10.6.0. Did Software Update, it said there was a 10.6.2 update (guess it combined 10.6.1 and 10.6.2 into one?), so I downloaded it, it installed a
-
Videos on some websites aren't loading but my flash player is updated?
On some webistes like Facebook when I try to load a video it will just show a loading sign and it won't play. It works on Youtube though. I updated my flash player and some websites still aren't working.