0 Replies Latest reply on Jan 4, 2005 10:35 AM by Ronald Mathies

    Fail to convert between UTF8 and UCS2: failUTF8Conv

    Ronald Mathies Newbie

      Hi All,

      I'm working on JBoss 3.2.3 with an Oracle 8.1.7 server. I'm using de ojdbc14.jar.

      I get the error message from above when i'm trying to retrieve data from the database. If i try to retrieve the data using a small Java test client using the same code all works great. Except when i try to retrieve it from within JBoss (Stateless Session Bean).

      The field i'm trying to retrieve is a CLOB field.

      The character encoding of the database is WE8MACROMAN8S. I cannot change this encoding due to other software running on this server.

      Has anyone got an idea why the difference is there between JBoss en the simple client.

      Simple Client Code:

      import java.io.*;
      import java.sql.*;
      
      import oracle.jdbc.*;
      import oracle.sql.*;
      
      public class TestClient {
      
       public TestClient() {
       try {
       Connection connection = null;
       PreparedStatement statement = null;
       StringBuffer result = new StringBuffer();
      
       DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
      
       connection = DriverManager.getConnection("jdbc:oracle:thin:user/pass@127.0.0.1:1521:DB");
       connection.setAutoCommit(false);
      
       statement = connection.prepareStatement("select wsl_won_programme_xml from _won_sent_programme_log where wsl_seq = ?");
      
       statement.setLong(1, 2423);
       OracleResultSet oracleResultSet = (OracleResultSet) statement.executeQuery();
       if (oracleResultSet.next()) {
       CLOB clob = oracleResultSet.getCLOB(1);
       BufferedReader br = new BufferedReader(clob.getCharacterStream());
       String line = null;
      
       while ((line = br.readLine()) != null) {
       result.append(line);
       }
       }
      
       System.out.println(result.toString());
       } catch (SQLException e) {
       e.printStackTrace();
       } catch (IOException e) {
       e.printStackTrace();
       }
      
       }
      
       public static void main(String[] args) {
       new TestClient();
       }
      }