title: Using Types.NVARCHAR with oracle JDBC driver to work with Cyrillic chars
body: <p>I am trying to use the <a href="http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/global.htm#BABJFAGA" rel="nofollow">"New Methods for National Character Set Type Data in JDK 1.6"</a>, to get a <strong>standard JDBC</strong> solution to handle cyrillic chars, but when the execution reaches any line with NVARCHAR type, for instance:</p>
  
  <pre><code>preparedSelect.setObject(3, "суббота", Types.NVARCHAR);
  </code></pre>
  
  <p>Then I get this exception:</p>
  
  <pre><code>java.sql.SQLException: Invalid column type
      at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
      at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:197)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:269)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:490)
      at oracle.jdbc.driver.OraclePreparedStatement.setObjectCritical(OraclePreparedStatement.java:7922)
      at oracle.jdbc.driver.OraclePreparedStatement.setObjectInternal(OraclePreparedStatement.java:7502)
      at oracle.jdbc.driver.OraclePreparedStatement.setObject(OraclePreparedStatement.java:7975)
      at oracle.jdbc.driver.OraclePreparedStatementWrapper.setObject(OraclePreparedStatementWrapper.java:222)
  </code></pre>
  
  <p>I also tried to use setNString() but I get an even more strange exception:</p>
  
  <pre><code>java.lang.AbstractMethodError: oracle.jdbc.driver.OraclePreparedStatementWrapper.setNString(ILjava/lang/String;)V
  </code></pre>
  
  <p>If I use java -Doracle.jdbc.defaultNChar=true myApplication with regular Types.VARCHAR, the Russian words are stored correctly. But using -Doracle.jdbc.defaultNChar=true is not an option since I'm working on a legacy application, I do not have control of running production environment, I'm just writing a component to it. Furthermore, this <a href="http://www.oracle.com/technology/sample_code/tech/java/codesnippet/jdbc/nchar/readme.html" rel="nofollow">"Readme for NChar How-to"</a> states that "This conversion has a substantial performance impact". So setting everything to NChar by default when only less than 1% of my tables needs this conversion in not a smart choice.</p>
  
  <p>I'm using oracle thin driver and I have ojdbc6.jar and orai18n.jar in my classpath.</p>
  
  <p>I'm looking for a standard JDBC solution. I can not use any methods or constants with "oracle" on them. OraclePreparedStatement is not an option for me.</p>
  
  <p>I tried using Types.NVARCHAR with MSSQL Server and it runs fine.</p>