Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Location
    Stockholm, Sweden
    Posts
    15

    Unanswered: JDBC problem -- javax.naming.NotContextException: Not an instance of DirContext

    Does anybody know what the following JDBC stack trace indicates while connecting to a Oracle 9.2.0.4.0:

    java.sql.SQLException: Io exception: JNDI Package failurejavax.naming.NotContextException: Not an instance of DirContext
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:179)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBE rror.java:334)
    at oracle.jdbc.ttc7.TTC7Protocol.handleIOException(TT C7Protocol.java:3695)
    at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.j ava:352)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleC onnection.java:362)
    at oracle.jdbc.driver.OracleDriver.getConnectionInsta nce(OracleDriver.java:536)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriv er.java:328)
    at java.sql.DriverManager.getConnection(DriverManager .java:512)
    at java.sql.DriverManager.getConnection(DriverManager .java:140)
    ...

    The call I do is:
    java.sql.DriverManager.getConnection(urlString, infoProperties);

  2. #2
    Join Date
    Dec 2003
    Location
    Noida, India.
    Posts
    171
    public class NotContextException
    extends NamingException
    This exception is thrown when a naming operation proceeds to a point where a context is required to continue the operation, but the resolved object is not a context. For example, Context.destroy() requires that the named object be a context. If it is not, NotContextException is thrown. Another example is a non-context being encountered during the resolution phase of the Context methods.

    It is also thrown when a particular subtype of context is required, such as a DirContext, and the resolved object is a context but not of the required subtype.

    Synchronization and serialization issues that apply to NamingException apply directly here.

    visit: http://java.sun.com/j2se/1.4.2/docs/...Exception.html
    Oracle can do wonders !

  3. #3
    Join Date
    May 2003
    Location
    Stockholm, Sweden
    Posts
    15
    Originally posted by cmasharma
    visit: http://java.sun.com/j2se/1.4.2/docs/...Exception.html
    Thanks, but I already know the javadoc. My problem is that all of this is happening deep down in the Oracle JDBC driver which I have no way of debugging.

  4. #4
    Join Date
    May 2003
    Location
    Stockholm, Sweden
    Posts
    15

    Lightbulb Solution

    In my case the javax.naming.NotContextException "Not an instance of DirContext" was caused by the fact that I used a Properties object as argument to getConnection that contained some stuff (I think it was mappings of java.naming.* properties) that was not relevant to nor intended for the JDBC driver. After creating a new Properties instance that only contained "user" and "password" properties it works fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •