J.E.Y J.E.Y - 1 year ago 101
Java Question

what's the data source url for LDAP type

I am using Spring jdbc api to connect to a Oracle database. Only LDAP style of connection is provided to that particular database, and I succeeded in making the connection from Oracle's database client SQL developer.

One thing seems odd to me is the format of the connection string:


it worked when applied in SQL developer, however you would notice that there are two numbers which supposedly represent port number, but why two?

Nevertheless I used the above url in my code, which looks like:

public DataSource getDataSource(){
SimpleDriverDataSource ds = new SimpleDriverDataSource();

ds.setDriver(new OracleDriver());

try(Connection conn = ds.getConnection()){
}catch(Exception e){
return ds;

Not surprisingly it shows an error like:

java.lang.NumberFormatException: For input string: "4050:4049"

Anyone can help?

Settings in SQL developer:

enter image description here

Answer Source

It seems that if you specify two port numbers the first is used for the ldap protocol, the second for the ldaps protocol (found a hint at http://yong321.freeshell.org/oranotes/OracleConnectionSetup.html, the following is more definitive: http://docs.oracle.com/cd/B28359_01/network.111/b28317/ldap.htm).

It can be that the Oracle JDBC driver does not understand this syntax. Please try if one of these alternative connection strings work for you:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download