Tuesday, August 11, 2015

SQL Developer - viewing BLOBs or CLOBs with the internal viewer

Environment / assumptions for this post:
  • SQL Developer 4.x (likely goes back quite a ways)
I've been using SQL Developer for an embarassingly long time before I discovered this one. I did a quick poll of a few people around the office - two others knew about it and two others did not. I guess I should read the New Features of a version when it comes out. Anyway, the tip could be summarized as - Use the little pencil! If you are looking at some results of a query, click a cell and a pencil will appear.

SQL Developer query results - cliking the pencil allows you to view BLOB types


You have a few options:

  • External editor;
  • Download;
  • Internal viewer as Image or Text

SQL Developer - viewing a BLOB as Image or Text, internally or externally


If it is a photo, you can look at it inline by clicking Image:

SQL Developer Internal viewer showing an image from a BLOB


If it is a CLOB, or even, say, a Microsoft Word document, you can click Text:

SQL Developer Internal viewer showing a Microsoft Word docx file from a CLOB


Tuesday, July 14, 2015

Occasional dropped JDBC connections with Integrated WLS in JDeveloper 11.1.1.6

Environment / assumptions for this post:

  • JDeveloper 11.1.1.6 and Integrated Weblogic Server
  • WLS Console application
  • JDBC Datasource configuration


I was getting an inconsistent error relating to configuration of a datasource on my local JDeveloper's Integrated Weblogic Server.

java.sql.SQLException: Cannot obtain connection: driverURL = jdbc:weblogic:pool:dsname, props = {EmulateTwoPhaseCommit=false, connectionPoolID=dsname, jdbcTxDataSource=true, LoggingLastResource=false, dataSourceName=dsname}.
Nested Exception: java.lang.RuntimeException: Failed to setAutoCommit to true for pool connection.
at weblogic.jdbc.wrapper.PoolConnection.init(PoolConnection.java:47)
at weblogic.jdbc.pool.Driver.allocateConnection(Driver.java:252)
at weblogic.jdbc.pool.Driver.connect(Driver.java:163)

In the end, to make sure WLS new about the dead connections we configured two things in the Weblogic Datasource, under Advanced tab: the Test Connections on Reserve and also Seconds to Trust an Idle Pool Connection.

Weblogic Datasource configuration - Test Connections on Reserve, and
Seconds to Trust an Idle Pool Connection

Tuesday, June 23, 2015

Accessing Weblogic Console gives 404 and Log4JLogger cannot be found

Environment / assumptions in this post:

  • Weblogic 10.3.6
  • Enterprise Manager 11.1.1.6
  • Fusion Middleware domain with 11.1.1.6 ADF libraries

I recently came across this problem on one of our 11.1.1.6 development environments, Weblogic version 10.3.6.  The Enterprise Manager was working fine, but going to the WL console gave a 404. For sure EM is used more often, but we would occasionally use the Console to configure Providers in the Security Realm and a few other things. Very strange. A bounce of the Admin Server sometimes would fix unexplained problems, but not this time.

Checking the Admin Server logs revealed this error:

Caused By: org.apache.commons.logging.LogConfigurationException: User-specified log class 'org.apache.commons.logging.impl.Log4JLogger' cannot be found or is not useable.
        at org.apache.commons.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:874)
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:604)

So there would appear to be a conflict with logging classes of some kind, or something was missing. In the end, the fix was pretty simple.  The weblogic-application.xml of the console application had to be modified to include the packages that were missing. How and why they went missing is a mystery so far, could be the result of security patching or some other system updates.   If it happens again, it will be interesting to see if the problem and solution is exactly the same or not.

What we did to fix it - we navigated to the console's weblogic-application.xml file located here:

<weblogic_home>/server/lib/consoleapp/META-INF/

and added the following to the beginning of the  <prefer-application-packages> section:

    <package-name>org.apache.log4j.*</package-name>
    <package-name>org.apache.commons.*</package-name>

And then restart the Admin Server. The Console should be available again.