Menu

#118 Error when running orathin and ldap

open
5
2014-08-22
2010-10-27
No

How do I connect to a oracle db via ldap ? This doesn't work :

<target name="schemaspy">
<mkdir dir="${schemaspy.out.dir}" />
<java jar="${ivy.lib.dir}/schemaspy-5.0.0.jar" classpathref="build.class.path"
output="${schemaspy.out.dir}/schemaspy-out.log"
error="${schemaspy.out.dir}/schemaspy-error.log"
fork="true">
<arg line="-t orathin"/>
<arg line="-db ${udv.connection.name}"/>
<arg line="-u ${udv.connection.username}"/>
<arg line="-p ${udv.connection.password}"/>
<arg line="-cp ${ivy.lib.dir}/ojdbc6-11.2.0.1.0.jar"/>
<arg line="-host sqlnet.xx.xxx.xxx"/>
<arg line="-port 389"/>
<arg line="-connprops cn=OracleContext;dc=xx;dc=xx;dc=xx"/>
<arg line="-o ${schemaspy.out.dir}"/>
</java>
</target>

Please help me :-)

Discussion

  • John Currier

    John Currier - 2010-10-28

    I'm not sure what orathin has to do with LDAP nor do I have any experience with using LDAP with Oracle. I imagine you'll need to put backslashes in front of the equals signs in the connprops line.

    Stating that it doesn't work doesn't give me much to go on.

     
  • Claus Nielsen

    Claus Nielsen - 2010-10-29

    Hi John,
    First, thanks a lot for a very nice tool :-)

    Here is my problem:

    url for connecting to Oracle:
    jdbc:oracle:thin:@localhost:1521:XE

    with ldap:
    jdbc:oracle:thin:@ldap://sqlnet.xx.xx.xx:389/XE,cn=OracleContext,dc=xx,dc=xx,dc=xx ldap://sqlnet2.xx.xx.xx:389/XE,cn=OracleContext,dc=xx,dc=xx,dc=xx

    Here is my ant script:
    <target name="schemaspy">
    <mkdir dir="${schemaspy.out.dir}" />
    <java jar="${ivy.lib.dir}/schemaspy-5.0.0.jar" classpathref="build.class.path"
    output="${schemaspy.out.dir}/schemaspy-out.log"
    error="${schemaspy.out.dir}/schemaspy-error.log"
    fork="true">
    <arg line="-t orathin"/>
    <arg line="-db XE"/>
    <arg line="-u ${udv.connection.username}"/>
    <arg line="-p ${udv.connection.password}"/>
    <arg line="-cp ${ivy.lib.dir}/ojdbc6-11.2.0.1.0.jar"/>
    <arg line="-host sqlnet.xx.xx.xx"/>
    <arg line="-port 389"/>
    <arg line="-connprops cn\=OracleContext;dc\=xx;dc\=xx;dc\=xx"/>
    <arg line="-o ${schemaspy.out.dir}"/>
    </java>
    </target>

    Failed to connect to database URL [jdbc:oracle:thin:@ldap://sqlnet.xx.xx.xx:389:XE]

    java.sql.SQLException: JNDI Package failure javax.naming.CommunicationException: localhost:389 [Root exception is java.net.ConnectException: Connection refused: connect]
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
    at net.sourceforge.schemaspy.SchemaAnalyzer.getConnection(SchemaAnalyzer.java:582)
    at net.sourceforge.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:157)
    at net.sourceforge.schemaspy.Main.main(Main.java:42)
    Caused by: oracle.net.ns.NetException: JNDI Package failure javax.naming.CommunicationException: localhost:389 [Root exception is java.net.ConnectException: Connection refused: connect]
    at oracle.net.jndi.JndiAttrs.<init>(JndiAttrs.java:159)
    at oracle.net.resolver.AddrResolution.<init>(AddrResolution.java:190)
    at oracle.net.ns.NSProtocol.connect(NSProtocol.java:216)
    at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1042)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:301)
    ... 7 more

    Isen't it possible to define a -url parameter instead ?

    Best regards
    Claus Nielsen
    Denmark

     
  • John Currier

    John Currier - 2010-10-29

    The simplest approach would be to create an orathinldap.properties file with replaceable params for each required parameter. It would look something like:

    description=Oracle with Thin Driver using LDAP

    extends=ora

    connectionSpec=jdbc:oracle:thin:@ldap://<host>:<port>/<db>,cn=OracleContext,dc=<dc>
    host=database host
    port=port on database host
    db=database SID as known on host
    dc=some description of the dc parameter to be given if it isn't specified

    Drop it somewhere on your file system and point to it with -t.

    Let me know,
    John

     
  • Claus Nielsen

    Claus Nielsen - 2010-11-01

    Thanks alot John :-)

    That helped :-)

    Best regards
    Claus

     

Log in to post a comment.