Java.sql.SQLException: Fail to convert between UTF8 and UCS2: failUTF8Conv

Hi all,
I am writing a servlet that connects to Oracle 8.0.6 through jdbc for jdk1.2 on NT 4.0
English version and it works fine.
But when the servlet is deployed to a solaris with Oracle 8.0.5 (not a typo, the oracle on
NT is 8.0.6 and oracle on solaris is 8.0.5) and jdbc for jdk1.2 (of course, for Solaris),
the servlet failed with the Exception:
java.sql.SQLException: Fail to convert between UTF8 and UCS2: failUTF8Conv
(I am using JRun 3.0 as the application and web server for both NT and Solaris)
(The database in both the NT and solaris platform are using UTF8 charset)
My servlet looks like this: (dbConn is a Connection object proved to be connected to Oracle
in previous segment of the same method):
String strSQL = "SELECT * FROM test";
try { Statement stmt = dbConn.createStatement();
ResultSet rs = stmt.execute(strSQL);
while (rs.next()) {
out.println("id = " + rs.getInt("id"));
System.out.println("id written");
out.println("name = " + rs.getString("name")); // <-- this is the line the
exception is thrown
System.out.println("name written");
} catch (java.sql.SQLException e) {
System.out.println("SQL Exception");
System.out.println(e);
The definition of the "test" table is:
create table test(
id number(10,0),
name varchar2(30));
There are about 10 rows exists in the table "test", in which all rows contains ONLY chinese
characters in the "name" field.
And when I view the System log, the string "id written" is shown EXACTLY ONCE and then there
is:
SQL Exception
java.sql.SQLException: Fail to convert between UTF8 and UCS2: failUTF8Conv
That means the resultset is fetch back from the database correctly. The problem arise only
during the getString("name") method.
Again, this problem only happens when the servlet is run on the solaris platform.
At first I would expect there are some strange code shown on the web page rather than having
an exception. I know that I should use getBytes to convert between different encodings, but
that's another story.
One more piece of information: When all the rows contains ascii characters in their "name"
field, the servlet works perfectly even in solaris.
If anyone knows why and how to tackle the problem please let me know. You can feel free to
send email to me at [email protected]
Many thanks,
Ben
null

Hi all,
For the problem I previously posted, I found that Oracle had had such bug filed before in Oracle 7.3.2 (something like that) and is classified to be NOT A BUG.
A further research leads me to the document of Oracle that the error message:
"java.sql.SQLException: Fail to convert between UTF8 and UCS2: failUTF8Conv"
is a JDBC driver error message of error number ORA-17037.
I'm still wondering why this behaviour will happen only in Solaris platform. The servlet on an NT machine I am using (which has an Oracle 8.0.6 and jdbc for jdk 1.2 running) is working just fine. I also suspect that this may be some sort of mistakes from jdbc driver.
Nevertheless, I have found a way to work around the problem that I cannot get non-English string from Oracle in Solaris and I would like to share it with you all here.
Before I go on, I found that there are many people out there on the web that encounter the same problem. (Some of which said s/he has been working on this problem for a month). As a result, if you find this way of working around the problem does help you, please tell those who have the same problem but don't know how to tackle. Thanks very much.
Here's the way I work it out. It's kinda simple, but it does work:
Instead of using:
String abc = rs.getString("SomeColumnContainsNonEnglishCharacters");
I used this:
String abc = new String(rs.getBytes("SomeColumnContainsNonEnglishCharacters"));
This will give you a string WITH YOUR DEFAULT CHARSET (or ENCODING) from your system.
If you want to convert the string read to some other encoding type, say Big5, you can do it like this:
String abc = new String(rs.getBytes("SomeColumneContainsNonEnglishCharacters"), "BIG5");
Again, it's simple, but it works.
Finally, if anyone knows why the fail to convert problem happens, please kindly let me know by leaving a word in [email protected]
Again, thanks to those of you who had tried to help me out.
Creambun
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by creambun creambun ([email protected]):
Hi all,
I am writing a servlet that connects to Oracle 8.0.6 through jdbc for jdk1.2 on NT 4.0
English version and it works fine.
But when the servlet is deployed to a solaris with Oracle 8.0.5 (not a typo, the oracle on
NT is 8.0.6 and oracle on solaris is 8.0.5) and jdbc for jdk1.2 (of course, for Solaris),
the servlet failed with the Exception:
java.sql.SQLException: Fail to convert between UTF8 and UCS2: failUTF8Conv
(I am using JRun 3.0 as the application and web server for both NT and Solaris)
(The database in both the NT and solaris platform are using UTF8 charset)
My servlet looks like this: (dbConn is a Connection object proved to be connected to Oracle
in previous segment of the same method):
String strSQL = "SELECT * FROM test";
try { Statement stmt = dbConn.createStatement();
ResultSet rs = stmt.execute(strSQL);
while (rs.next()) {
out.println("id = " + rs.getInt("id"));
System.out.println("id written");
out.println("name = " + rs.getString("name")); // <-- this is the line the
exception is thrown
System.out.println("name written");
} catch (java.sql.SQLException e) {
System.out.println("SQL Exception");
System.out.println(e);
The definition of the "test" table is:
create table test(
id number(10,0),
name varchar2(30));
There are about 10 rows exists in the table "test", in which all rows contains ONLY chinese
characters in the "name" field.
And when I view the System log, the string "id written" is shown EXACTLY ONCE and then there
is:
SQL Exception
java.sql.SQLException: Fail to convert between UTF8 and UCS2: failUTF8Conv
That means the resultset is fetch back from the database correctly. The problem arise only
during the getString("name") method.
Again, this problem only happens when the servlet is run on the solaris platform.
At first I would expect there are some strange code shown on the web page rather than having
an exception. I know that I should use getBytes to convert between different encodings, but
that's another story.
One more piece of information: When all the rows contains ascii characters in their "name"
field, the servlet works perfectly even in solaris.
If anyone knows why and how to tackle the problem please let me know. You can feel free to
send email to me at [email protected]
Many thanks,
Ben<HR></BLOCKQUOTE>
null

Similar Messages

  • SQL Exception: Fail to convert between UTF8 and UCS2: failUTF8Conv

    Hi,
    I am trying to use the DBMS_OBFUSCATION_TOOLKIT to encrypt/decrypt some strings through JDBC, but I am getting the following exception:
    SQL Exception: Fail to convert between UTF8 and UCS2: failUTF8Conv
    The input and output parameters for the encryption/decryption functions are VarChar2.
    Our database is using UTF8.
    I will be glad if someone can help me on this.
    Thanks,
    Cenk

    Susi,
    This is just a wild guess, but your java client is on a different computer to your Oracle 9.2 server, and the locale (or encodings) on the two computers is different. Am I correct? If so, then I guess you need to change the locales (or encodings) so that they match.
    Have you tried printing out the "System" properties for the two JVMs (Oracle's and your client's)? Something simple like this:
    System.getProperties().list()Good Luck,
    Avi.

  • JBO-27022, Fail to convert between UTF8 and UCS2: failUTF8Conv

    steps to reproduce :
    on a Database with UTF8 as NLS_CHARACTERSET
    create table test (s1 varchar2(10), s2 varchar2(32));
    DECLARE
    l_data varchar2(4000);
    return_data varchar2(4000);
    skey varchar2(255);
    p_str varchar2(10);
    BEGIN
    p_str := 'Test';
    skey := chr(20) || chr(115) || chr(110) || chr(122) || chr(37) || chr(37) || chr(94) || chr(48);
    l_data := rpad (p_str,(trunc(length(p_str)/8)+1)*8, chr(0));
    dbms_obfuscation_toolkit.DESEncrypt (input_string=&gt;l_data, key_string =&gt;skey,
    encrypted_string =&gt; return_data);
    insert into test values ('1',return_data);
    END;
    commit;
    Now create a new Workspace and a new "Business Components Package"
    with only table test selected.
    In the tester we get an oracle.jbo.AttributeLoadException:
    (oracle.jbo.AttributeLoadException) JBO-27022: Failed to load value at index 2
    with java object of type java.lang.String due to java.sql.SQLException.
    ----- LEVEL 1: DETAIL 0 -----
    (java.sql.SQLException) Fail to convert between UTF8 and UCS2: failUTF8Conv
    oracle.jbo.AttributeLoadException: JBO-27022: Failed to load value at index 2 with java object of type java.lang.String due to java.sq[i]Long postings are being truncated to ~1 kB at this time.

    This is still happening in jdev9031.
    And it is very easy to reproduce!
    How can we avoid this error?
    Thanks,
    Bert.

  • Help me,Fail to convert between UTF8 and UCS2: failUTF8Conv

    using SUN APP server 7.0 + Studio 4 +oracle9i to develop cmp, when i input chinese in some fields, i encount following errors:
    java.sql.SQLException: Fail to convert between UTF8 and UCS2: failUTF8Conv
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
    at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:916)
    at oracle.jdbc.dbaccess.DBConversion.failUTF8Conv(DBConversion.java:1958)
    at oracle.jdbc.dbaccess.DBConversion.utf8BytesToJavaChars(DBConversion.java:1797)
    at oracle.jdbc.dbaccess.DBConversion.charBytesToJavaChars(DBConversion.java:828)
    at oracle.jdbc.dbaccess.DBConversion.CHARBytesToJavaChars(DBConversion.java:783)
    at oracle.jdbc.ttc7.TTCItem.getChars(TTCItem.java:231)
    at oracle.jdbc.dbaccess.DBDataSetImpl.getCharsItem(DBDataSetImpl.java:1094)
    at oracle.jdbc.driver.OracleStatement.getCharsInternal(OracleStatement.java:2947)
    at oracle.jdbc.driver.OracleStatement.getStringValue(OracleStatement.java:3103)
    at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:5089)
    at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4964)
    at oracle.jdbc.driver.OracleResultSetImpl.getObject(OracleResultSetImpl.java:404)
    at com.sun.jdo.spi.persistence.support.sqlstore.ResultDesc.getConvertedObject(ResultDesc.java:399)
    at com.sun.jdo.spi.persistence.support.sqlstore.ResultDesc.setFields(ResultDesc.java:746)
    at com.sun.jdo.spi.persistence.support.sqlstore.ResultDesc.getResult(ResultDesc.java:635)
    at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.executeQuery(SQLStoreManager.java:648)
    at com.sun.jdo.spi.persistence.support.sqlstore.SQLStoreManager.retrieve(SQLStoreManager.java:500)
    at com.sun.jdo.spi.persistence.support.sqlstore.SQLStateManager.reload(SQLStateManager.java:1197)
    at com.sun.jdo.spi.persistence.support.sqlstore.SQLStateManager.loadForRead(SQLStateManager.java:3797)
    at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerImpl.getObjectById(PersistenceManagerImpl.java:604)
    at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerWrapper.getObjectById(PersistenceManagerWrapper.java:247)
    at com.tops.gdgpc.EntityBean.SpeBaseTable.SpeBaseTableBean_1769729755_ConcreteImpl.jdoGetInstance(SpeBaseTableBean_1769729755_ConcreteImpl.java:2479)
    at com.tops.gdgpc.EntityBean.SpeBaseTable.SpeBaseTableBean_1769729755_ConcreteImpl.ejbLoad(SpeBaseTableBean_1769729755_ConcreteImpl.java:2267)
    at com.sun.ejb.containers.EntityContainer.callEJBLoad(EntityContainer.java:2372)
    at com.sun.ejb.containers.EntityContainer.afterBegin(EntityContainer.java:1362)
    at com.sun.ejb.containers.BaseContainer.startNewTx(BaseContainer.java:1405)
    at com.sun.ejb.containers.BaseContainer.preInvokeTx(BaseContainer.java:1313)
    at com.sun.ejb.containers.BaseContainer.preInvoke(BaseContainer.java:462)
    at com.tops.gdgpc.EntityBean.SpeBaseTable.SpeBaseTableBean_1769729755_ConcreteImpl_EJBObjectImpl.getSpeBaseTable(SpeBaseTableBean_1769729755_ConcreteImpl_EJBObjectImpl.java:24)
    at com.tops.gdgpc.EntityBean.SpeBaseTable._SpeBaseTable_Stub.getSpeBaseTable(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor23.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sun.forte4j.j2ee.ejbtest.webtest.InvocableMethod$MethodIM.invoke(InvocableMethod.java:233)
    at com.sun.forte4j.j2ee.ejbtest.webtest.EjbInvoker.getInvocationResults(EjbInvoker.java:98)
    at com.sun.forte4j.j2ee.ejbtest.webtest.DispatchHelper.getForward(DispatchHelper.java:191)
    at jasper.dispatch_jsp._jspService(_dispatch_jsp.java:127)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:552)
    at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:368)
    at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:287)
    at javax.servlet.http.HttpServle
    I think it is caused by that the fields' not enought long.UTF must use 3 characters for one chinese,but in our database only 2 characters for one chinese.How can I resolve this puzzle,please help me!

    I've got many more tips from our experts:
    1. One thing you can try to do is make sure that Oracle Databse is set to UTF-8. If this is the case then you need to make sure that the client encoding is UTF-8.
    2. A colleague at Oracle points out that oracle.jdbc.* is a package that Oracle
    provides, not Sun. He says you might try asking this question on an Oracle
    forum. He writes:
    We have Oracle Technology Network (OTN) discussion forum, which would be a good place to
    start with this question.
    Oracle Technology Network (OTN) " Technologies " Java " SQLJ/JDBC
    Try the SQLJ/JDBC forum first.
    -- markus.

  • Fail to convert between UTF8 and UCS2: failUTF8Conv

    We need to store possibly all UTF8 chararacter in his database
    especially $ & ( 4 8 < = > from WE8ISO8859P1 and from WE8ISO8859P15.
    So we install an UTF8 instance and set NLS_LANG to UTF8.
    We have to do select/update from a java client and sqlplus(like).
    When we insert with java client it's unreadable from sqlplus and
    when whe insert from sqlplus we've got 'Fail to convert between UTF8 and UCS2: failUTF8Conv '
    here the code made in sqlplus
    update CPW_TEST set lb_comportement='$ & ( 4 8 < = > ' WHERE ID_TEST=14805;
    here the code made in java
    update CPW_TEST set lb_comportement='$ & ( 4 8 < = > ' WHERE ID_TEST=14804;
    and then the result in database
    SELECT id_test,LB_COMPORTEMENT FROM CPW_TEST WHERE ID_TEST=14804 or ID_TEST=14805
    ID_TEST LB_COMPORTEMENT
    14804 B$ B& B( B4 B8 B< B= B> B
    14805 $ & ( 4 8 < = >
    2 rows selected
    and the dump
    SELECT id_test,dump(LB_COMPORTEMENT) FROM CPW_TEST WHERE ID_TEST=14804 or ID_TEST=14805
    ID_TEST DUMP(LB_COMPORTEMENT)
    14804 Typ=1 Len=26: 194,164,32,194,166,32,194,168,32,194,180,32,194,184,32,194,188,32,194,189,32,194,190,32,194,128
    14805 Typ=1 Len=17: 164,32,166,32,168,32,180,32,184,32,188,32,189,32,190,32,128
    2 rows selected
    I'm not sure, but it seems that sqlplus uses true UTF8 (variable length codes) and java client uses UCS-2 (2 bytes)
    How can I solve my problem?
    Our configuration
    javaclient (both thin and oci jdbc driver 8.1.7), sqlplus client and database Oracle 8.1.7.0.0 on the same computer (W2000 or NT4)
    Thank you for yoru attention.

    Hi Luis, thanks for your suggestions. You're right that problem was in JServ and his JVM.
    There was conflict between different versions of Java. While iFS was using JRE 1.3.1, JServ was configured to use JRE 1.1.8. As soon as I corrected link to the right Java, problem disappears.
    Radek

  • Failed to convert between UTF8 and UCS2: failUTF8Conv

    This error appear when trying to install the database cache. Does this have something to do with the classes111.zip or classes12.zip files?

    I have the same problem in XP. I installed the whole Oracle9i product on my desktop and after a day or two the message began appearing on my machine. I couldnt use any of the tools. I tried uninstallinmg according to Oracles instruction and after installing again had the same problem.
    I logged a TAR and they advised me to reinstall but according to Oracles instructions for removing the software first.
    Will keep you posted

  • Fail to convert between UTF8 and UCS2

    : java.sql.SQLException: Fail to convert between UTF8 and UCS2: failUTF8Conv
    (BC4J throws that exception)
    I got that error message when try to show the table's content in uix page.
    I use varchar2(40). the error occurs, when i set special characters like õ,ü,Ü.. and so on.
    This affects only UTF encoded database.
    We use: 9.0.2.5, Jdev9.0.3.3., UIX, iAS 9.4.2??(i dont'know)
    As i know the problem is when there is 40 letters in the column and it contains "special character" it can't convert it, because the neccessary space requered to store values is much more.
    If i use nvarchar, i don't think it fix this problem.
    And as i know, all sql constant must use where coulmn=N'constans value' format.
    Q:
    How can i set the UTF database and BC4J to run correctly.
    I mean... what type to use, what is the column size to set.
    Thanks in advice,
    Viktor

    I had the same problem using Oracle 9i. The problem lied within the Oracle JDBC driver itself! --;
    If you're using JDBC driver from Oracle 9i, stop using it!
    You should download JDBC driver of Oracle 10g from Oracle site and use that driver instead.
    After I changed the driver, I now have no problem of getting Korean characters from the database.
    Hope this would solve your problem too.

  • Fail to Convert between UTF8 and UCS2: fail UTF Conversion

    I'm using the JReport software, a product which generates java reports based on a jdbc datasource.
    during installation the JReport installation program located Microsoft java VM installed on my PC and I accepted this option to be working JVM for JReport.
    This worked very well. I have installed jdbc driver for Oracle 8.1.5 that worked fine as well on the design time (I have connected to Oracle, I have seen my tables and other information on my DB).
    But when I switched the run-time view (when real data is going to load) then the following exception message appeared :
    "Fail to Convert between UTF8 and UCS2: fail UTF Conversion" .
    if there is anybody who understood my problem any kind of help will be appreceated
    It will be helpfull to receive any suggestions made to this matter.
    Anything relative help will be welcome.
    thanks in advance.

    I had the same problem using Oracle 9i. The problem lied within the Oracle JDBC driver itself! --;
    If you're using JDBC driver from Oracle 9i, stop using it!
    You should download JDBC driver of Oracle 10g from Oracle site and use that driver instead.
    After I changed the driver, I now have no problem of getting Korean characters from the database.
    Hope this would solve your problem too.

  • Fail to convert between UTF8 and UCS2: failUTFConversion

    Hi
    I use Oracle 8.1.5 with NLS = 'CL8MSWIN1251' (russian).
    JDeveloper 3.0 and JDBC
    if I write - "select substr(str,1, 10 ) from table"
    I have not Exception, but I get instead of 10 symbol - only 5
    if I write - select substr(str,1, 11 ) from table
    I have Exception.
    if I write - "select Convert(str,'CL8MSWIN1251') from table"
    I have not any problem.
    What is it problem? How I can ok
    if I write- "select str from table"
    Igor Leonov
    null

    Hi!
    It's Oracle 7.3 server problem - wrong UTF conversion. Try to use Oracle8.

  • Java.sql.SQLException: Fail to convert to internal representation:

    HI All,
    I have a procedure hich is taking the Varray ADDR_CONTACT_VA as input which is varray of object .
    ADDR_CONTACT_OBJ [] address = new ADDR_CONTACT_OBJ[20];
    address[0] = new ADDR_CONTACT_OBJ();
    address[0].setOpportunityId(26731);
    address[0].setAddr_ln_1("100, Street");
    address[0].setAddr_ln_2("Cast card Street");
    address[0].setAddr_ln_3("Cast card Street");
    address[0].setAddr_ln_4(null);
    address[0].setAddr_ln_5(null);
    address[0].setAddr_ln_6(null);
    address[0].setAddress_name("GVPN Testing");
    address[0].setAddressType("HQ");
    address[0].setCity("Mumbai");
    address[0].setContact_title("Mr.");
    address[0].setCountry("India");
    address[0].setEmail_contact_id(null);
    address[0].setName_contact_id(null);
    address[0].setOSO_Address_id(124959);
    address[0].setOso_contact_id(317694);
    address[0].setOso_party_site_id(69387);
    address[0].setPincode("470003");
    address[0].setState("Maharashtra");
    address[0].setContact_firstname("First");
    address[0].setContact_lastname("Last");
    address[0].setContact_email(null);
    address[0].setContact_phone_day("91-45234-4534556");
    address[0].setDay_phone_contact_id(287326);
    System.out.println("Vishwa3: after creating an y array");
    ArrayDescriptor desc1 = ArrayDescriptor.createDescriptor("ADDR_CONTACT_VA",nativeConnection);
    System.out.println("Vishwa4: after creating an y array");
    ARRAY input1 = new ARRAY(desc1,nativeConnection,address);
    System.out.println("Vishwa5: after creating an y array");
    %>
    <% proc_stmt = (OracleCallableStatement)nativeConnection.prepareCall("{ call DBP_UPDATE_STATUSCUSTOMER_DETAILS(?,?)}");
    proc_stmt.setArray(1,input1);
    proc_stmt.registerOutParameter(2,OracleTypes.CURSOR);
    System.out.println("Vishwa6: after creating an y array");
    %>
    <% proc_stmt.execute();
    ResultSet result =(ResultSet)proc_stmt.getObject(2);
    while(result!=null)
    System.out.println(result.getString(1));
    System.out.println(result.getString(2));
    System.out.println(result.getString(3));
    System.out.println(result.getString(4));
    System.out.println(result.getString(5));
    when i try to execute this procedure ai m gettin the exception like
    java.sql.SQLException: Fail to convert to internal representation: com.sy.vo.ADDR_CONTACT_OBJ@4a594a59_
    Please help me to resolve this probelm .it is verey verey urgrnt for me
    Thanks in Advance.....................
    Viswa

    First use code tags when posting code.
    Second you can't simply use a java object as an database array type. It certainly looks like you are doing that.

  • Sql Exceptionjava.sql.SQLException: Fail to convert to internal representat

    Hai,
    I tryed to execute the following code and getting the error as
    Sql Exceptionjava.sql.SQLException: Fail to convert to internal representation.
    try{
                   Class.forName("oracle.jdbc.driver.OracleDriver");
                   connection= DriverManager.getConnection("jdbc:oracle:thin:@180.190.30.30:1521:jb3db1","jbl_pathart","jbl_pathart");
    statment=connection.prepareStatement (
                                  "SELECT path.pathway_name, phy.physiology_name, org.organism_name, path.is_physiology," +
                                  " jpty.pathway_type_name, path.pathway_id" +
                                  " FROM pathway path, physiology phy, organism org, jbl_pathway.pathway_type jpty "+
                                  " WHERE path.physiology_id = phy.physiology_id "+
                                  " AND path.organism_id = org.organism_id "+
                                  " AND path.pathway_type_id = jpty.pathway_type_id "+
                                  " AND path.pathway_id = " + i);
                        ResultSet rs=statment.executeQuery();
                        while(rs.next()){                    
                             orgName          = rs.getString(1);
                             phyName          = rs.getString(2);
                             pathwayName     = rs.getString(3);
                             is_physiology     = rs.getString(4);
                             pathwayId          = rs.getInt(5);
    } catch (Exception e){
                   System.out.println("Sql Exception"+e);
         }

    Please do this first...replace the following bit of code:
    } catch (Exception e){
    System.out.println("Sql Exception"+e);
    }with
    } catch (Exception e){
        e.printStackTrace();
    }If you do this, it'll even tell you exactly which line is throwing the exception.

  • Java.sql.SQLException: Fail to construct descriptor: Unable to resolve type

    Unable to resolve the type declared in Oracle.
    This is the type which i create. When am indexing the type am unable to access the type from java. The type is directly created under the schema.
    type pepc_partial_qual_nmTab1 is table of varchar2(20) index by binary_integer;
    anArrayDescriptor1 = new oracle.sql.ArrayDescriptor("PEPC_PARTIAL_QUAL_NMTAB1",con);
      anARRAYout1 = new ARRAY(anArrayDescriptor1, con, anArrayOut1);
      cstmt.setARRAY(1,anARRAYout1);
      cstmt.registerOutParameter(1,OracleTypes.ARRAY, "PEPC_PARTIAL_QUAL_NMTAB1");
    This is how I try accessing the type from JAVA.
    Thanks in Advance

    Think I found a solution,.. or at least stopped getting the error. I'm using oracle's OracleCallableStatement instead of the java.sql.CallableStatement. I'm also using a different app server. same version 9.0.2.0.0 I'd recommend applying the patches to anyone using this version. I've ran into some errors that have been patched. It's a long process though..
    cheers.

  • Java.sql.SQLException: The TCP/IP connection to the host  has failed.

    Hello. I hope you had a happy new year! Now its back to work.
    I am having a problem connecting to a remote SQL Server DB. I am using NetBeans 5.5 and the latest J2EE. I am able to see the tables in the IDE and bind objects to data. But when I run it it gets this:
    java.sql.SQLException: Error in allocating a connection. Cause: Connection could not be allocated because: The TCP/IP connection to the host has failed. java.net.ConnectException: Connection refused: no further information
    at com.sun.gjc.spi.DataSource.getConnection(DataSource.java:100)
    at com.sun.sql.rowset.internal.CachedRowSetXReader.connect(CachedRowSetXReader.java:344)
    at com.sun.sql.rowset.internal.CachedRowSetXReader.readData(CachedRowSetXReader.java:126)
    at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:968)
    at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:1428)
    I checked the SQL Server Configuration manager on that machine and TCP/IP connections are allowed. What else could be wrong?
    Thank You.

    "Connection refused" means that the client sends a packet saying "I would like to connect to port number NNNN please" to the server computer, and the server computer's OS sends the reply "there is no process listening to that port on the network interface you are using".
    The database server is not running, or running but not listening to TCP/IP connections, or at a different port from what you think, or listening to only selected network interfaces (it is possible for a process to listen to a specific interface or a wildcard for all interfaces). A less likely scenario is that a firewall is sending the "connection refused" message.
    First aid check list for "connection refused":
    - Check host name in connect string.
    - Check port number in connect string.
    - Try numeric IP address of server host in connect string, in case name server is hosed.
    - Are there any firewalls between client and server blocking the port.
    - Check that the db server is running.
    - Check that the db server is listening to the port. On the server, try: "telnet localhost the-port-number". Or "netstat -an", there should be a listening entry for the port. You need to configure the database to accept TCP connections; the server documentation or google should explain how.
    - Try "telnet server-host-name the-port-number" from the client, to see if firewalls are blocking it.
    - If "telnet" fails: try telnet with the numeric ip address.
    - If "telnet" fails: does it fail immediately or after an obvious timeout? How long is the timeout?
    - Does the server respond to "ping serverhost" or "telnet serverhost" or "ssh serverhost"?

  • Java.sql.SQLException: Login failed for user 'ccms'.

    Windows Server 2003 R2 Enterprise x64 Edition service pack 1
    SQL Server 2000 Enterprise edition 32 bit, SP4 : 2000.8.00.2039
    jdbc driver: jtds
    connection string: jdbc:jtdsqlserver://ZH-DATA-4:1434/[dbname];instance=[instance name]
    the connectivity works fine...almost.
    I have 2 identical sql servers one of which is linked to the other via a linked server config which for one particular query gives back the error I give in the subject of this thread:
    java.sql.SQLException: Could not get the data of the row from the OLE DB provider 'SQLOLEDB'
    if I run the exact same sql string in query analyser it runs with no problem.
    if have similar queries also running from java which use the linked server and these do not give an error. I am at a loss as to explain why this is happening.
    the query in question joins together a number of views which reference the linked server.
    I have tried everything I can think of including recreating the views and linked server definition.
    If all is OK in query analyser, how can it fail when called over jbdc (especially when all other db requests succeed) ?

    refer below link
    http://blog.soapplied.com/2013/06/websphere-distributed-transactions-with.html

  • JDeveloper tutorial fails with java.sql.SQLException: ORA-00600

    In following the steps to the JDeveloper tutorial, after I successfully created and tested my connections, I proceeded on to run ImageLoader.java (Under DatabaseSetup.jws), and it returns an exception. The debug output log is as follows:
    Diagnostics: Routing diagnostics to standard output (use -Djbo.debugoutput=silent to remove)
    Successfully loaded properties file using: getResourceAsStream("/oracle/jbo/common/Diagnostic.properties");
    [00] Diagnostic Properties: Timing:false Functions:false Linecount:true Threshold:6
    [01] CommonMessageBundle (language base) being initialized
    [02] Stringmanager using default locale: 'null'
    [03] BC4JDeployPlatform: LOCAL
    [04] Propertymanager: searching for file and system based properties
    [05] {{ begin Loading BC4J properties
    [06] -----------------------------------------------------------
    [07] BC4J Property jbo.default.language='en' -->(MetaObjectManager) from System Default
    [08] BC4J Property jbo.default.country='US' -->(MetaObjectManager) from System Default
    [09] BC4J Property DeployPlatform='LOCAL' -->(SessionImpl) from Client Environment
    [10] Skipping empty Property ConnectionMode from System Default
    [11] Skipping empty Property HostName from System Default
    [12] Skipping empty Property ConnectionPort from System Default
    [13] Skipping empty Property ApplicationPath from System Default
    [14] Skipping empty Property java.naming.security.principal from System Default
    [15] Skipping empty Property java.naming.security.credentials from System Default
    [16] BC4J Property jbo.use.pers.coll='false' -->(SessionImpl) from System Default
    [17] BC4J Property jbo.pers.max.rows.per.node='70' -->(SessionImpl) from System Default
    [18] BC4J Property jbo.pers.max.active.nodes='10' -->(SessionImpl) from System Default
    [19] BC4J Property jbo.pcoll.mgr='oracle.jbo.pcoll.OraclePersistManager' -->(SessionImpl) from System Default
    [20] BC4J Property jbo.fetch.mode='AS.NEEDED' -->(MetaObjectManager) from System Default
    [21] Skipping empty Property JBODynamicObjectsPackage from System Default
    [22] BC4J Property MetaObjectContextFactory='oracle.jbo.server.xml.DefaultMomContextFactory' -->(MetaObjectManager) from /oracle/jbo/server/jboserver.properties resource
    [23] BC4J Property MetaObjectContext='oracle.jbo.server.xml.XMLContextImpl' -->(MetaObjectManager) from /oracle/jbo/server/jboserver.properties resource
    [24] BC4J Property java.naming.factory.initial='oracle.jbo.common.JboInitialContextFactory' -->(SessionImpl) from Client Environment
    [25] BC4J Property IsLazyLoadingTrue='true' -->(MetaObjectManager) from /oracle/jbo/server/jboserver.properties resource
    [26] BC4J Property ActivateSharedDataHandle='false' -->(MetaObjectManager) from System Default
    [27] Skipping empty Property HandleName from System Default
    [28] Skipping empty Property Factory-Substitution-List from System Default
    [29] Skipping empty Property jbo.project from System Default
    [30] BC4J Property jbo.max.cursors='50' -->(MetaObjectManager) from System Default
    [31] BC4J Property jbo.dofailover='true' -->(MetaObjectManager) from System Default
    [32] BC4J Property jbo.doconnectionpooling='false' -->(MetaObjectManager) from System Default
    [33] BC4J Property jbo.recyclethreshold='10' -->(MetaObjectManager) from System Default
    [34] BC4J Property jbo.passivationstore='null' -->(MetaObjectManager) from System Default
    [35] BC4J Property RELEASE_MODE='Reserved' -->(MetaObjectManager) from System Default
    [36] BC4J Property jbo.maxpoolcookieage='-1' -->(MetaObjectManager) from System Default
    [37] Skipping empty Property PoolClassName from System Default
    [38] BC4J Property jbo.maxpoolsize='2147483647' -->(MetaObjectManager) from System Default
    [39] BC4J Property jbo.initpoolsize='0' -->(MetaObjectManager) from System Default
    [40] BC4J Property jbo.poolrequesttimeout='30000' -->(MetaObjectManager) from System Default
    [41] BC4J Property jbo.assoc.consistent='true' -->(MetaObjectManager) from System Default
    [42] BC4J Property jbo.SQLBuilder='Oracle' -->(MetaObjectManager) from /oracle/jbo/server/jboserver.properties resource
    [43] BC4J Property jbo.ConnectionPoolManager='oracle.jbo.server.ConnectionPoolManagerImpl' -->(MetaObjectManager) from System Default
    [44] BC4J Property jbo.TypeMapEntries='Oracle' -->(MetaObjectManager) from /oracle/jbo/server/jboserver.properties resource
    [45] BC4J Property jbo.jdbc.trace='false' -->(MetaObjectManager) from System Default
    [46] BC4J Property oracle.jbo.defineColumnLength='true' -->(MetaObjectManager) from System Default
    [47] Skipping empty Property jbo.tmpdir from System Default
    [48] Skipping empty Property jbo.server.internal_connection from System Default
    [49] Skipping empty Property SessionClass from System Default
    [50] Skipping empty Property TransactionFactory from System Default
    [51] BC4J Property jbo.debugoutput='console' -->(Diagnostic) from System Property
    [52] BC4J Property jbo.debug.prefix='DBG' -->(Diagnostic) from /oracle/jbo/common/Diagnostic.properties resource
    [53] BC4J Property jbo.logging.show.timing='false' -->(Diagnostic) from /oracle/jbo/common/Diagnostic.properties resource
    [54] BC4J Property jbo.logging.show.function='false' -->(Diagnostic) from /oracle/jbo/common/Diagnostic.properties resource
    [55] BC4J Property jbo.logging.show.level='false' -->(Diagnostic) from /oracle/jbo/common/Diagnostic.properties resource
    [56] BC4J Property jbo.logging.show.linecount='true' -->(Diagnostic) from /oracle/jbo/common/Diagnostic.properties resource
    [57] BC4J Property jbo.logging.trace.threshold='6' -->(Diagnostic) from /oracle/jbo/common/Diagnostic.properties resource
    [58] BC4J Property jbo.jdbc.driver.verbose='false' -->(Diagnostic) from System Default
    [59] BC4J Property jbo.ejb.txntimeout='60' -->(SessionImpl) from System Default
    [60] BC4J Property jbo.ejb.txntype='global' -->(MetaObjectManager) from System Default
    [61] Skipping empty Property oracle.jbo.schema from System Default
    [62] WARNING: Unused property: LC='Calling Function' found in /oracle/jbo/common/Diagnostic.properties resource
    [63] }} finished loading BC4J properties
    [64] -----------------------------------------------------------
    Diagnostics: Routing diagnostics to standard output (use -Djbo.debugoutput=silent to remove)
    [65] Diagnostic Properties: Timing:false Functions:false Linecount:true Threshold:6
    [66] JavaVMVersion: 1.2.351 odv
    [67] JavaVMVendor: Oracle Corp.
    [68] JavaVMName: OJVM VM
    [69] OperatingSystemName: Windows NT
    [70] OperatingSystemVersion: 5.0
    [71] OperatingSystemUsername: Administrator
    [72] Connected to Oracle JBO Server - Version: 3.2.9.76.3
    [73] {{+++ id=10000 type: 'BC4J_CREATE_ROOTAM' Create Root Application Module 'ImageLoader.ImageLoaderModule'
    [74] {{+++ id=10001 type: 'METAOBJECT_LOAD' Loading meta-object: ImageLoader.ImageLoaderModule
    [75] {{+++ id=10002 type: 'METAOBJECT_LOAD' Loading meta-object: ImageLoader.ImageLoader
    [76] Loading from /ImageLoader/ImageLoader.xml file
    [77] Loading from indvidual XML files
    [78] Loading the Containees for the Package 'ImageLoader.ImageLoader'.
    [79] }}+++ End Event10003 null
    [80] Loading from /ImageLoader/ImageLoaderModule.xml file
    [81] }}+++ End Event10002 null
    [82] {{+++ id=10003 type: 'METAOBJECT_LOAD' Loading meta-object: ImageLoader.InventoryItem1View
    [83] Loading from /ImageLoader/InventoryItem1View.xml file
    [84] ViewObjectImpl's default fetch mode = 0
    [85] {{+++ id=10004 type: 'METAOBJECT_LOAD' Loading meta-object: ImageLoader.InventoryItem
    [86] Loading from /ImageLoader/InventoryItem.xml file
    [87] Loading Typemap entries from oracle.jbo.server.OracleTypeMapEntries
    [88] CSMessageBundle (language base) being initialized
    [89] }}+++ End Event10005 null
    [90] OracleSQLBuilder reached getInterface
    [91] Oracle SQL Builder Version 3.2.0.0.0
    [92] }}+++ End Event10004 null
    [93] {{+++ id=10005 type: 'BC4J_CREATE_VIEWOBJECT' Create ViewObject 'InventoryItem1View'
    [94] }}+++ End Event10006 null
    [95] Created root application module: 'ImageLoader.ImageLoaderModule'
    [96] Locale is: 'en_US'
    [97] }}+++ End Event10001 null
    [98] Using DatabaseTransactionFactory implementation oracle.jbo.server.DatabaseTransactionFactory
    [99] DBTransactionImpl Max Cursors is 50
    [100] Oracle SQLBuilder: Registered driver: oracle.jdbc.driver.OracleDriver
    [101] {{+++ id=10006 type: 'JDBC_CONNECT' null
    [102] Trying connection/1: url='jdbc:oracle:thin:bc4j/bc4j@localhost:1521:oracle9i'...
    [103] }}+++ End Event10007 null
    [104] Successfully logged in
    [105] JDBCDriverVersion: 8.1.7.0.0
    [106] DatabaseProductName: Oracle
    [107] DatabaseProductVersion: Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production With the Partitioning option JServer Release 9.0.1.1.1 - Production
    [108] Column count: 8
    [109] {{+++ id=10007 type: 'EXECUTE_QUERY' ViewObject executeQueryForCollection InventoryItem1View
    [110] {{+++ id=10008 type: 'VIEWOBJECT_GETSTATEMENT' Viewobject: InventoryItem1View getting prepared statement
    [111] ViewObject : Created new QUERY statement
    [112] SELECT InventoryItem.ID, InventoryItem.NAME, InventoryItem.DESCRIPTION, InventoryItem.IMAGE, InventoryItem.PRICE, InventoryItem.ONHAND, InventoryItem.SUPPLIER_ID, InventoryItem.CATEGORY_ID FROM INVENTORY_ITEM InventoryItem
    [113] {{+++ id=10009 type: 'JDBC_CREATE_STATEMENT' createPreparedStatement - prefetch size: 1
    [114] }}+++ End Event10010 null
    [115] }}+++ End Event10009 ViewObject : Creating new QUERY statementSELECT InventoryItem.ID, InventoryItem.NAME, InventoryItem.DESCRIPTION, InventoryItem.IMAGE, InventoryItem.PRICE, InventoryItem.ONHAND, InventoryItem.SUPPLIER_ID, InventoryItem.CATEGORY_ID FROM INVENTORY_ITEM InventoryItem
    [116] QueryCollection.executeQuery failed...
    [117] java.sql.SQLException: ORA-00600: internal error code, arguments: [ttcgcshnd-1], [0], [], [], [], [], [], []
         java.lang.Class java.net.URLClassLoader.findClass(java.lang.String)
         java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean)
         java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean)
         java.lang.Class sun.misc.Launcher$AppClassLoader.loadClass(java.lang.String, boolean)
         java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String)
         java.util.Enumeration oracle.jbo.common.WeakHashtableImpl.elements()
         java.util.Enumeration oracle.jbo.common.WeakHashtable.elements()
         void oracle.jbo.server.ViewObjectImpl.freeStatement(java.sql.PreparedStatement, boolean)
         void oracle.jbo.server.QueryCollection.executeQuery(java.lang.Object[], int)
         void oracle.jbo.server.ViewObjectImpl.executeQueryForCollection(java.lang.Object, java.lang.Object[], int)
         void oracle.jbo.server.ViewRowSetImpl.execute(boolean, boolean)
         void oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed()
         boolean oracle.jbo.server.ViewRowSetIteratorImpl.hasNext()
         boolean oracle.jbo.server.ViewRowSetImpl.hasNext()
         boolean oracle.jbo.server.ViewObjectImpl.hasNext()
         void ImageLoader.ImageLoader.main(java.lang.String[])
    [118] SELECT InventoryItem.ID, InventoryItem.NAME, InventoryItem.DESCRIPTION, InventoryItem.IMAGE, InventoryItem.PRICE, InventoryItem.ONHAND, InventoryItem.SUPPLIER_ID, InventoryItem.CATEGORY_ID FROM INVENTORY_ITEM InventoryItem
    oracle.jbo.SQLStmtException: JBO-27122: SQL error during statement preparation. Statement: SELECT InventoryItem.ID, InventoryItem.NAME, InventoryItem.DESCRIPTION, InventoryItem.IMAGE, InventoryItem.PRICE, InventoryItem.ONHAND, InventoryItem.SUPPLIER_ID, InventoryItem.CATEGORY_ID FROM INVENTORY_ITEM InventoryItem
         void oracle.jbo.server.ViewRowSetImpl.execute(boolean, boolean)
         void oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed()
         boolean oracle.jbo.server.ViewRowSetIteratorImpl.hasNext()
         boolean oracle.jbo.server.ViewRowSetImpl.hasNext()
         boolean oracle.jbo.server.ViewObjectImpl.hasNext()
         void ImageLoader.ImageLoader.main(java.lang.String[])
    ## Detail 0 ##
    java.sql.SQLException: ORA-00600: internal error code, arguments: [ttcgcshnd-1], [0], [], [], [], [], [], []
         void oracle.jbo.server.ViewRowSetImpl.execute(boolean, boolean)
         void oracle.jbo.server.ViewRowSetIteratorImpl.ensureRefreshed()
         boolean oracle.jbo.server.ViewRowSetIteratorImpl.hasNext()
         boolean oracle.jbo.server.ViewRowSetImpl.hasNext()
         boolean oracle.jbo.server.ViewObjectImpl.hasNext()
         void ImageLoader.ImageLoader.main(java.lang.String[])
    Exception in thread main
    At first I thought maybe this is a configuration specific problem -- but I was able to replicate this on two separate machine with clean Win2K and Oracle9i installs.
    It seems like it is not finding a particular class, which leads me to believe that some particular jar is probably missing -- can anyone help me figure out which one? Or is there something else that may be going wrong?
    TIA

    You need to make sure you're using the Oracle9i JDBC driver, or using the Oracle 8.1.7.2 JDBC driver as I mentioned above.
    If you are using JDeveloper9i release 9.0.2 or 9.0.3, the driver you need is in <jdevhome>\jdbc\lib
    Otherwise, you can also download the drivers from OTN.

Maybe you are looking for