Posts tagged as:

Reference

  • Download the 32 bit flavor of “basiclite”, sqlplus, the sdk, and jdbc (if you need it) from download.oracle.com Note: as of 10.2, 64 bit works on snow leopard but not lion.
  • unzip the downloads and place them somewhere out of the way like /Applications/Develop/oracle  the files should be combined into a single folder.  In my case /Applications/Develop/oracle/instantclient_10_2
    this is a strange place, a personal quirk of mine, put it wherever you’d like, just make the appropriate adjustments below.

    unzip instantclient-basic-macosx-10.2.0.4.0.zip
    unzip instantclient-sqlplus-macosx-10.2.0.4.0.zip
    unzip instantclient-sdk-macosx-10.2.0.4.0.zip
    unzip instantclient-jdbc-macosx-10.2.0.4.0.zip
  • make links
    cd instantclient_10_2
    ln -s libclntsh.dylib.10.1 libclntsh.dylib
    ln -s libocci.dylib.10.1 libocci.dylib
  • setup some environment variables… edit your ~/.profile
    # oracle
    export DYLD_LIBRARY_PATH="/Applications/Develop/oracle/instantclient_10_2"
    export SQLPATH="/Applications/Develop/oracle/instantclient_10_2"
    export TNS_ADMIN="/Applications/Develop/oracle/network/admin"
    #export NLS_LANG="AMERICAN_AMERICA.UTF8"
    export PATH=$PATH:$DYLD_LIBRARY_PATH
  • setup a tnsnames.ora in /Applications/Develop/oracle/network (or elsewhere just fix TNS_ADMIN export line above)
  • populate it with something – you’re on your own here unless you happen to be using the ldstech oracle vm, then use this…
    xe=
      (DESCRIPTION=
        (ADDRESS_LIST=
          (ADDRESS=
            (PROTOCOL=TCP)
            (HOST=192.168.56.101)
            (PORT=1521)
          )
        )
        (CONNECT_DATA=
          (SID=xe)
        )
      )
  • restart terminal and test a connection with something like sqlplus username@sid

{ 3 comments }

Stack Trace Visibility via JNDI lookup

by Bruce on June 7, 2010

We use a JNDI lookup to control whether a stack trace is visible. This allows us to have the stack trace visible in our development and test environments, but not in production. We have have maven deploy the correct catalina.properties according to your environment (which is outside the scope of this post). For example, in a test environment the catalina.properties.test would be deployed whereas the catalina.properties.prod would be deployed for production. There are other ways to accomplish turning stack traces on and off automatically according to your environment. Why not show the stack trace everywhere? Security, hide as much from a potential hacker (besides QA and the security team) as is possible.

applicationContext.xml

<jee:jndi-lookup jndi-name="ShowStackTrace" id="showStackTrace" />

context.xml
add this to the Container Resource element

<Environment name="ShowStackTrace" 
             type="java.lang.Boolean" 
            value="${screening.showStackTrace}" />

catalina.properties

screening.showStackTrace=false

and finally, have something like this in the jsp configured to display the exception…

<c:if test="${showStackTrace}">
    <div id="dev">
        <a href="#" id="exception-toggle">Show stack trace</a>
        <div id="exception" style="display:none;">
            <c:if test="${not empty exception}">
                <h3>${exception}</h3>
                <p>
                    <c:forEach items="${exception.stackTrace}" 
                                 var="trace">
                        ${trace}<br/>
                    </c:forEach>
                </p>
            </c:if>
        </div>
    </div>
</c:if>

{ 0 comments }