This content has been marked as final. Show 4 replies
Set the url, username and password as follows:
String url = "jdbc:oracle:thin:@ldap://ldap-server:389/CN=Admin,O=COHERIS,C=FR"; Properties prop = new Properties(); prop.put("java.naming.security.authentication", "simple"); prop.put("java.naming.security.principal","CN=Admin,O=COHERIS,C=FR"); prop.put("java.naming.security.credentials", "password"); OracleDataSource ods = new OracleDataSource(); ods.setURL(url); ods.setConnectionProperties(prop);
sorry for reopening this old thread but I'm stuck logging on an LDAP server.
This is my ldap.ora:
normally I simply do from sqlplus:
may you please repost your code replacing my cutom values?
I know my request is quite stupid but I can't understand were is the user and password values in your code...
tanks a lot
Does your ldap setup allow anonymous binds or do you need to authenticate? Are you using wallets and NAMES.LDAP_AUTHENTICATE_BIND to allow sqlplus to connect?
This code should connect to a database using ldap as the name resolution method with ldap anonymous binds. If you are using authenticated ldap, then you must add the additional code above to connect to ldap.
String ldapHost = "ldap-server:389"; String context = ",dc=nl,dc=abnamro,dc=com"; String serviceName = "mts-a-de-grid"; String user = "aldo"; String pass = "aldo"; String url = "jdbc:oracle:thin:@ldap://" + ldapHost + "/" + instance + ldap_context; OracleDataSource o = new OracleDataSource(); o.setUser(user); o.setPassword(password); o.setURL(url); Connection conn = o.getConnection();
Tanks for post friscoki.
Now I'm able to connect.
Given your code, I only added "OracleContext" to the context since server type is OID
thanks for help, bye