JDBC connect support for oracle service nosid

Help
Anonymous
2010-05-25
2012-09-09
  • Anonymous - 2010-05-25

    Would like to support the service connection url as opposed to the SID - (have
    an oracle instance that is addressed via service id and not the SID

    is there a way to support the service id in the connection url (the 1st method
    via the 2nd) it appears that I cannot construct the URL using the serviceid.

    // String url = "jdbc:oracle:thin:@//server.local:1521/prod";

    // jdbc:oracle:thin:@//host:port/service

    // or

    // String url = "jdbc:oracle:thin:@server.local:1521:prodsid";

    // jdbc:oracle:thin:@host:port:SID

     
  • Sualeh Fatehi

    Sualeh Fatehi - 2010-05-26

    Can you access your database using a test JDBC program and the Oracle JDBC
    driver, using the first URL? If you can, SchemaCrawler will be able to acces
    your database using that URL too, since SchemaCrawler uses JDBC and the Oracle
    JDBC driver.

     
  • Anonymous - 2010-05-26

    I'll construct the test java code right now and let you know - I'm trying this
    with the sc.cmd / sc.sh command line programs, and they don't appear to have
    options that support the service id calls, (no SID).

     
  • Sualeh Fatehi

    Sualeh Fatehi - 2010-05-26

    Once you have the JDBC URL, you can construct your own SchemaCrawler command-
    line. There is a variation of the SchemaCrawler command-line that accepts a
    URL. At this point, you will not be using sc.cmd/ sc.sh, but calling the Java
    executable directly, with the Oracle driver on the classpath.

     
  • Anonymous - 2010-05-26

    kewl - I was able to connect with the jdbc service syntax

    Class.forName("oracle.jdbc.OracleDriver");

    con = java.sql.DriverManager.getConnection(url);

    "jdbc:oracle:thin:XXXXX/XXXXXX@//cm.XXX.net:1527/cm.XXX.net";

    Can I just change the sc.sh invocation to call the with the URL / driver
    explicitly?

     
  • Sualeh Fatehi

    Sualeh Fatehi - 2010-05-26

    Try constructing a plain Java command-line first, taking a look at what is in
    sc.sh. Then you can put the Java command line that you constructed into sc.sh

     
  • Anonymous - 2010-05-26

    I'm reading thru the examples - and it looks like what I want to do it change
    the properties file to run a particular invocation as I describe above

    Oracle XE

    Database connection name: oraclexe

    oraclexe.host=192.168.1.2

    oraclexe.port=1521

    oraclexe.database=XE

    oraclexe.schemapattern=SCHEMACRAWLER

    oraclexe.user=schemacrawler

    oraclexe.password=schemacrawler

    oraclexe.driver=oracle.jdbc.OracleDriver

    oraclexe.url=jdbc:oracle:thin:@${host}:${port}/

    can I just make this

    oraclexe.url=jdbc:oracle:thin:userid/PW@//hostname:1527/serviceid

    I'm going to try and see what happens (I can't infer how the other variables
    are used from this config file.)

     
  • Anonymous - 2010-05-26

    ok - i"m working it - ty.

     
  • Sualeh Fatehi

    Sualeh Fatehi - 2010-05-26

    You should not need to change the properties files - there is a flavor of the
    command line that takes a URL and the JDBC driver class name.

     
  • Anonymous - 2010-05-26

    got it - using the schemacrawler-8.2-distrib did the following

    1) copy the oracle jdbc driver into ./lib

    2) use the url version of the command line

    (following)

    sc.sh -driver="oracle.jdbc.OracleDriver"
    -url="jdbc:oracle:thin:XXX/XXX@//cm.XXX.net:1527/cm.XXXnet" -schema=XXXX
    --command=list_objects

    worked great - thank you very much.

     
  • Sualeh Fatehi

    Sualeh Fatehi - 2010-05-26

    Excellent. Thanks for sharing this.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks