JDBC throws SQLException: failUTFConversion

hi,
i'm running: oracle 8.1.5 (server with an instance running utf8), classes111b.zip (jdbc - thin driver), nlscharset11.zip (to support utf8), orion (client - java application server/web server)
on the server, i've
$ echo $NLS_LANG
AMERICAN_AMERICA.UTF8
and
select * from v$nls_parameters where parameter='NLS_CHARACTERSET'
returns utf8
on the client, which is the web server, i get:
$ echo $NLS_LANG
AMERICAN_AMERICA.UTF8
when i do getString() on a JSP page, i got the SQLException:
java.sql.SQLException: Fail to convert between UTF8 and UCS2: failUTFConversion at oracle.jdbc.dbaccess.DBError.check_error(DBError.java) at oracle.jdbc.oracore.JavaConversion.CHARBytesToJavaChars(JavaConversion.java) at oracle.jdbc.oracore.JavaConversion.CharBytesToString(JavaConversion.java) at oracle.jdbc.driver.OracleStatement.getStringValue(OracleStatement.java) at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java) at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java)
i don't have any problem if the database contains only english, i.e. 1 byte utf8... however, i got that exception when the database contains chinese character
what should i do to make things work?
besides, i don't know where the web container called the code in nlscharset11.zip (although i included it in my classpath)
thx

hi, thx
for a)
i'm using orion (www.orionserver.com) as my client
according to their instruction, "Also remember to put the driver (zip/jar) for your database to the /lib dir in Orion." i put both the classes111b.zip and nlscharset11.zip into the /usr/local/orion/lib directory (where my ORION_HOME=/usr/local/orion) and have the CLASSPATH=/usr/java/jdk1.3/lib/tools.jar:/usr/share/java/ant.jar:/usr/share/java/jaxp.jar:/usr/share/java/parser.jar:/usr/local/orion/orion.jar:/usr/local/orion/lib/classes111b.zip :/usr/local/orion/lib/nlscharset11.zip
i also tried to add all classes in nlscharset11.zip to classes111b.zip, so i'm sure that the web server can access to the required classes. in addition, i attempted to move the modified classes111b.zip to another directory, and in that case, the web server gives the following error
# java -jar orion.jar
Error initializing server: DriverManagerDataSource driver 'oracle.jdbc.driver.OracleDriver' not found
for b)
how can i check whether the dumped bytes are correct UTF-8 bytes?
i have the following data in my utf8 database
New York
a$i
$i%;
and this is what i got from select dump(col, 16) from tab1
Typ=1 Len=8: 4e,65,77,20,59,6f,72,6b
Typ=1 Len=3: 61,a4,e9
Typ=1 Len=4: a4,e9,a5,bb
where a4,e9 and a5,bb are chinese char $i and %; respectively
is this correct? seems that the database stores a chinese char as 2 HEX codes... what does Typ means?
any suggestion (software) that i can use to enter unicode char?
thx

Similar Messages

  • Applet throws SQLException

    I have simple applet where a user clicks a button, which runs a stored procedure on a SQL database. The code that runs the SP is in a different class.
    In my applet I am trying to create an instance of that class and run the method that executes the stored procedure.
    The applet code is:
    public class clsButton extends Applet implements ActionListener
    public void init ()
    Button btnRunSp = new Button("Run Report All-YTD");
    setLayout(new FlowLayout(FlowLayout.CENTER));
    add(btnRunSp);
    public void actionPerformed(ActionEvent ae)
    sqlSPResults sqlRs = new sqlSPResults(); //Class for SP
    sqlRs.sqlRun(); //method that executes the SP
    The error I am getting is: "java.sql.SQLException; must be caught or declared to be thrown" and it points to the "." in sqlRs.sqlRun();.
    I have the throws SQLException statement on the method in the class I am trying to call:
    public class sqlSPResults
    public static void sqlRun() throws SQLException, IOException
    Not sure why the throws statement on the underlying method is not recognized and not sure how to solve the problem.
    TIA,
    Todd

    The "throws" clause on that method is recognized, and it is exactly that clause that requires your code in the clsButton class to catch the exception. To fix this problem, you usually have two approaches, as the error message says. You can catch the error, like this:try {
      sqlRs.sqlRun(); //method that executes the SP
    } catch(SQLException e) {
      // code that deals with an SQLException
    }Or sometimes you can declare that the method containing the line of code throws SQLException. In this case, however, you can't do that because you are implementing the actionPerformed method and you can't change its signature that way.
    You will also have to do the same for IOException, which is also thrown by the sqlRun method.

  • JDBC:ODBC, Resultset with 0 rows throws SqlException

    For short, I have used forte for java version 3.0 ea to create an application which is manipulating data in an MS SQLServer database. Further I have installed JDK 1.3.1 and JRE 1.3.1, running on WINDOWS 2000 os.
    The DB-configuring is set to binary sort order.
    When my program is running a "rs = stmt.executQuery() then the situation is:
    1) If this query results in 1 or more rows in the resultset, everything seems to work fine.
    2) But if the resultset doesn't contains any rows, which is a quit legal result and actually a succes criteria in a certain point in my prg., an SQLException is thrown stating "Invalid object name + 'database tablename in uppercase'". Although the db-tables name is in mixedletters (see the code below).
    For testing purpose I have worked out a quit simpel prg. which reflects the real prg. I enclose it for examining purpose.
    I certaintly hope somebody is able to guide me to a solution.
    Thanks in advance.
    Kind regards
    Kuno Reck
    IBC Systems A/S
    TestCode:
    import java.sql.*;
    import javax.swing.*;
    //import javax.swing.table.*;
    class DBTest {
    private static final String driver = "sun.jdbc.odbc.JdbcOdbcDriver",
    dbUrl = "jdbc:odbc:KEKVRF",
    comUser = "tbs", password = "tbs";
    private static Connection conn;
    private static Statement stmt;
    private static ResultSet rs;
    // String queryDdi = "SELECT DISTINCT N.DdiNumber FROM DdiNumbers N left
    join DdiGroups G on N.DdiNumber = G.DdiNumber and N.ProviderId = G.ProviderId
    WHERE 1 = 1 AND N.DdiNumber BETWEEN 35248305 AND 35248309 ORDER BY N.DdiNumber";
    // String queryDdi = "SELECT DISTINCT N.DdiNumber FROM DdiNumbers N left
    join DdiGroups G on N.DdiNumber = G.DdiNumber and N.ProviderId = G.ProviderId
    WHERE 1 = 1 AND N.DdiNumber = 35248307 ORDER BY N.DdiNumber";
    String queryDdi = "SELECT DdiNumber FROM DdiNumbers WHERE DdiNumber =
    35548307";
    public static void main (String[] args){
    DBTest dbtest = new DBTest();
    public DBTest() {
    try{
    Class.forName(driver);
    conn = DriverManager.getConnection(dbUrl, comUser, password);
    java.sql.DriverManager.setLogStream(java.lang.System.out);
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    rs = stmt.executeQuery(queryDdi);
    if (rs.isBeforeFirst()){
    while (rs.next()) {
    // BEM?RK! KolonneV?rdierne skal l?ses ud i samme r?kkef?lge som de
    selectes i sql-statementet.
    System.out.println("DdiNumber = "+rs.getString("DdiNumber"));
    else{
    JOptionPane.showMessageDialog(null, "> Ddi-number does not exist
    < ", "Validation of input fields", JOptionPane.ERROR_MESSAGE);
    catch (SQLException e){
    JOptionPane.showMessageDialog(null, "No matching records found, " +
    e.getMessage(), "SQLException", JOptionPane.ERROR_MESSAGE);
    System.exit(0);
    catch (ClassNotFoundException cnfe){
    JOptionPane.showMessageDialog(null, "ClassNotFoundException, " +
    cnfe.getMessage(), "ClassNotFoundException", JOptionPane.ERROR_MESSAGE);
    LogStream:
    C:\jdk1.3.1\bin>java DBTest
    *Connection.createStatement
    Allocating Statement Handle (SQLAllocStmt), hDbc=148181752
    hStmt=148185176
    Setting statement option (SQLSetStmtOption), hStmt=148185176, fOption=6,
    vParam=3
    Setting statement option (SQLSetStmtOption), hStmt=148185176, fOption=7,
    vParam=1
    Registering Statement sun.jdbc.odbc.JdbcOdbcStatement@17d257
    *Statement.executeQuery (SELECT DdiNumber FROM DdiNumbers WHERE DdiNumber =
    3554830
    7)
    *Statement.execute (SELECT DdiNumber FROM DdiNumbers WHERE DdiNumber = 35548307)
    Free statement (SQLFreeStmt), hStmt=148185176, fOption=0
    Executing (SQLExecDirect), hStmt=148185176, szSqlStr=SELECT DdiNumber FROM
    DdiNumbe
    rs WHERE DdiNumber = 35548307
    Number of result columns (SQLNumResultCols), hStmt=148185176
    value=1
    Get statement option (SQLGetStmtOption), hStmt=148185176, fOption=6
    value=3
    SQLWarning: reason(Result set type has been changed.)
    Number of result columns (SQLNumResultCols), hStmt=148185176
    value=1
    Number of affected rows (SQLRowCount), hStmt=148185176
    value=0
    Fetching (SQLFetchScroll), hStmt=148185176
    End of result set (SQL_NO_DATA)
    Get statement option (SQLGetStmtOption), hStmt=148185176, fOption=14
    RETCODE = -1
    ERROR - Generating SQLException...
    SQLException: SQLState(24000) vendor code(0)
    java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
    at sun.jdbc.odbc.JdbcOdbc.SQLGetStmtOption(JdbcOdbc.java:3773)
    at sun.jdbc.odbc.JdbcOdbcResultSet.calculateRowCount
    (JdbcOdbcResultSet.java
    :5982)
    at sun.jdbc.odbc.JdbcOdbcResultSet.initialize
    (JdbcOdbcResultSet.java:150)
    at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet
    (JdbcOdbcStatement.java:420)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery
    (JdbcOdbcStatement.java:250)
    at DBTest.<init>(DBTest.java:27)
    at DBTest.main(DBTest.java:18)
    Fetching (SQLFetchScroll), hStmt=148185176
    End of result set (SQL_NO_DATA)
    *Connection.createStatement
    Allocating Statement Handle (SQLAllocStmt), hDbc=148181752
    hStmt=148186208
    Setting statement option (SQLSetStmtOption), hStmt=148186208, fOption=6,
    vParam=0
    Setting statement option (SQLSetStmtOption), hStmt=148186208, fOption=7,
    vParam=1
    Registering Statement sun.jdbc.odbc.JdbcOdbcStatement@19c082
    *Statement.executeQuery (SELECT COUNT(*) FROM DDINUMBERS WHERE DDINUMBER =
    3554830
    7)
    *Statement.execute (SELECT COUNT(*) FROM DDINUMBERS WHERE DDINUMBER = 35548307)
    Free statement (SQLFreeStmt), hStmt=148186208, fOption=0
    Executing (SQLExecDirect), hStmt=148186208, szSqlStr=SELECT COUNT(*) FROM
    DDINUMBE
    RS WHERE DDINUMBER = 35548307
    RETCODE = -1
    ERROR - Generating SQLException...
    SQLException: SQLState(S0002) vendor code(208)
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid
    objec
    t name 'DDINUMBERS'.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:2494)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:334)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery
    (JdbcOdbcStatement.java:249)
    at sun.jdbc.odbc.JdbcOdbcResultSet.calculateRowCount
    (JdbcOdbcResultSet.java
    :6063)
    at sun.jdbc.odbc.JdbcOdbcResultSet.initialize
    (JdbcOdbcResultSet.java:150)
    at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet
    (JdbcOdbcStatement.java:420)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery
    (JdbcOdbcStatement.java:250)
    at DBTest.<init>(DBTest.java:27)
    at DBTest.main(DBTest.java:18)
    ResultSet.finalize sun.jdbc.odbc.JdbcOdbcResultSet@4ac268
    ResultSet.finalize sun.jdbc.odbc.JdbcOdbcResultSet@216869
    *ResultSet.close
    C:\jdk1.3.1\bin>

    Hi,
    my suggestion: you can't use isBeforeFirst() on empty result set. Try following:
    rs = stmt.executeQuery(queryDdi);
    int count = 0;
    while (rs.next()) {
      count++;
      System.out.println("DdiNumber = "+rs.getString("DdiNumber"));
    if (count == 0) {
    JOptionPane.showMessageDialog(null, "> Ddi-number does not exist < ", "Validation of input fields", JOptionPane.ERROR_MESSAGE);
    }Best Regards,
    Martin

  • Throw sqlexception: broken pipe when executing sql or other related code

    My env is:
    weblogic 704 + oracle 8i, use datasource to create conneciton pool with 10 connections
    when weblogic starts, but when I execute some sql , the system throwed out:
    java.sql.SQLException: Io Exception: Broken pipe
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
    at oracle.jdbc.driver.OracleStatement.open(OracleStatement.java:560)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2778)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:608)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:536)
    at weblogic.jdbc.pool.PreparedStatement.executeQuery(PreparedStatement.java:53)
    at com.ztsoft.ejb.dao.EntityDAO.readClobToFile(Unknown Source)
    at com.ztsoft.ejb.dao.SL_FileContentTbDAO.readClob2(Unknown Source)
    at com.ztsoft.ejb.sessionbean.MainHandlerBean.readClobToFile(Unknown Source)
    at com.ztsoft.ejb.sessionbean.MainHandlerBean_oejxo1_ELOImpl.readClobToFile(MainHandlerBean_oejxo1_ELOImpl.java:531)
    at com.ztsoft.web.servlet.GetResultActionServlet.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1075)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:418)
    How can I solve ? thanks, this is very urgent, help me..

    CottonXu wrote:
    My env is:
    weblogic 704 + oracle 8i, use datasource to create conneciton pool with 10 connections
    when weblogic starts, but when I execute some sql , the system throwed out:
    java.sql.SQLException: Io Exception: Broken pipe
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)Hi. This indicates a problem between the oracle driver version and the DBMS
    version. The first thing to do is to go to oracle's download site and get
    their latest version of the thin driver that is appropriate for your DBMS
    and JVM, and then edit your startWeblogic script so the new driver is ahead
    of the weblogic.jar in the -classpath argument for the commandline that
    starts the server.
    Joe
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
    at oracle.jdbc.driver.OracleStatement.open(OracleStatement.java:560)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2778)
    at oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:608)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:536)
    at weblogic.jdbc.pool.PreparedStatement.executeQuery(PreparedStatement.java:53)
    at com.ztsoft.ejb.dao.EntityDAO.readClobToFile(Unknown Source)
    at com.ztsoft.ejb.dao.SL_FileContentTbDAO.readClob2(Unknown Source)
    at com.ztsoft.ejb.sessionbean.MainHandlerBean.readClobToFile(Unknown Source)
    at com.ztsoft.ejb.sessionbean.MainHandlerBean_oejxo1_ELOImpl.readClobToFile(MainHandlerBean_oejxo1_ELOImpl.java:531)
    at com.ztsoft.web.servlet.GetResultActionServlet.service(Unknown Source)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1075)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:418)
    How can I solve ? thanks, this is very urgent, help me..

  • Stored procedure call throwing SQLException

    Our application recently migrated to WLS8.1 SP3 from 7.0 SP4. While registering the value to OracleTypes.CURSOR, I am getting the following exception. We are using oracle 8.1.7, and thin driver(Solaris 5.9). After installing I noticed that WLS8.1 does not have the classes12.zip file under WL_HOME/server/ext/jdbc/oracle/ directory, moreover the 8.1.7 folder itself is missing. Does the existing driver files came with 7.0 version is good enough to run the application in 8.1.3. Any help is appreciated.
    Here is the code that I use:
    cs = connection.prepareCall("{call PROC_NAME(?)}");
    cs.setNull(1, OracleTypes.CURSOR);
    cs.registerOutParameter(1, OracleTypes.CURSOR);
    cs.execute();
    Object obj = cs.getObject(1);
    Here is the exception that I get :
    java.sql.SQLException: Unsupported feature: sqlType=-10
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
         at oracle.jdbc.driver.OraclePreparedStatement.setNullInternal(OraclePreparedStatement.java:3719)
         at oracle.jdbc.driver.OracleCallableStatement.setNull(OracleCallableStatement.java:4145)
         at weblogic.jdbc.wrapper.PreparedStatement.setNull(PreparedStatement.java:419)
    Thanks,
    Rajeev

    Rajeev Mani wrote:
    Our application recently migrated to WLS8.1 SP3 from 7.0 SP4.
    While registering the value to OracleTypes.CURSOR, I am getting
    the following exception. We are using oracle 8.1.7, and thin driver
    (Solaris 5.9). After installing I noticed that WLS8.1 does not have
    the classes12.zip file under WL_HOME/server/ext/jdbc/oracle/ directory,
    moreover the 8.1.7 folder itself is missing. Does the existing driver
    files came with 7.0 version is good enough to run the application in 8.1.3. Any help is appreciated.
    Hi. If the same code works in 70, and doesn't in 81, it must be because of the
    newer version of the oracle thin driver that comes with 81. You can use the classes12.zip
    that worked for you in 70 by putting it somehwere in yout 81 installation (server\lib for instance)
    and editing your startWebLogic scripts to list it explicitly before the weblogic stuff.
    Eg, just before the line in the script that calls java to start the server, put this:
    set CLASSPATH=\myinstall\server\lib\classes12.zip;%CLASSPATH%
    or for Unixes:
    setenv CLASSPATH /myinstall/server/lib/classes12.zip:$CLASSPATH
    Joe
    Here is the code that I use:
    cs = connection.prepareCall("{call PROC_NAME(?)}");
    cs.setNull(1, OracleTypes.CURSOR);
    cs.registerOutParameter(1, OracleTypes.CURSOR);
    cs.execute();
    Object obj = cs.getObject(1);
    Here is the exception that I get :
    java.sql.SQLException: Unsupported feature: sqlType=-10
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
         at oracle.jdbc.driver.OraclePreparedStatement.setNullInternal(OraclePreparedStatement.java:3719)
         at oracle.jdbc.driver.OracleCallableStatement.setNull(OracleCallableStatement.java:4145)
         at weblogic.jdbc.wrapper.PreparedStatement.setNull(PreparedStatement.java:419)
    Thanks,
    Rajeev

  • Sender JDBC java.SQLException

    I am getting this error when i execute stored procedure, please let me know how can i proceed further.
    Database-level error reported by JDBC driver while executing statement 'EXEC spGetSAPPayroll'. The JDBC driver returned the following error message: 'java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]No rows affected.'. For details, contact your database server vendor.
    Thanks
    sneha

    Hi Sneha,
    Hope stored procedure returns some rows as a result set.. check out the stored procedure Format of the structure is correct ?  for this-
    http://help.sap.com/saphelp_nw2004s/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm
    Also make sure that , format of the xml message is correct in the XI for the stored procedure..for this you can refer -/people/siva.maranani/blog/2005/05/21/jdbc-stored-procedures
    Regards,
    Moorthy

  • What does XMLType.isFragment () throw SQLException with no details?

    package com.test.db.xml;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import oracle.jdbc.OracleResultSet;
    import oracle.xdb.XMLType;
    import oracle.xml.sql.query.OracleXMLQuery;
    public class TestXMLTypeMethods {
         // This test performs a simple insert into a table defined as
         // Name Type
         // ID NUMBER
         // DESCR VARCHAR2(32)
         // XMLDOC SYS.XMLTYPE
         public static void main(String[] args) {
              String sConn = "jdbc:oracle:thin:@saturn:1522:ssidev";
              String sUser = "scott";
              String sPass = "tiger";
              Connection          conn = null;
              Statement          stmt = null;
              ResultSet          rs = null;
              OracleResultSet orset = null;
              OracleXMLQuery     oraQry = null;
              try {
                   DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                   conn = DriverManager.getConnection(sConn, sUser, sPass);
                   stmt = conn.createStatement();
                   rs = stmt.executeQuery("select a.xmldoc from robxml1 a ");
                   orset = (OracleResultSet) rs;
                   while (orset.next()) {
                        XMLType tXML = XMLType.createXML(orset.getOPAQUE(1));
                        System.out.println (" *** SQL Type Name: " + tXML.getSQLTypeName());
                        try {
                             System.out.println (" *** isFragment() : " + tXML.isFragment());
                        } catch (SQLException e) {
                             while (e != null) {
                                  System.err.println (" " + e.getSQLState() + " " + e.getErrorCode() + " " + e.getMessage());
                                  e.printStackTrace();
                                  e = e.getNextException();
                        } catch (Exception e) {
                             e.printStackTrace();
              } catch (Exception e) {
                   e.printStackTrace();
              } finally {
                   try {
                        if (orset != null) {
                             orset.close();
                   } catch (Exception e) { /* ignore */
                   try {
                        rs.close();
                   } catch (Exception e) { /* ignore */
                   try {
                        stmt.close();
                   } catch (Exception e) { /* ignore */
                   try {
                        conn.close();
                   } catch (Exception e) { /* ignore */
              System.out.println("all done");

    hello,
    What is the error message. Atleast what is the output of
    System.out.println (" *** SQL Type Name: " + tXML.getSQLTypeName());
    Regards.

  • PreparedStatement.addBatch() throws SQLException: Unsupported feature

    Hi,
    We am using Oracle 8i with thin JDBC driver (classes12.zip) & JDK1.3.
    If we use normal statement for batch update, using OracleStatement.addBatch() and OracleStatement.executeBatch(), it works fine. Problem occurs when doing batch update with prepared statement, using OraclePreparedStatement.addBatch() and OraclePreparedStatement.executeBatch(). The see the exception below
    01-08-03 11:59:53 | ERROR | [Thread4] | user.BLineOS400CB_B1User:lvlAC_NOUser |
    Error in bbojUser
    java.sql.SQLException: Unsupported feature
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:274)
    at oracle.jdbc.driver.OraclePreparedStatement.addBatch(OraclePreparedSta
    tement.java:2847)
    at com.orbitech.frameworks.bline.user.BLineOS400CB_B1User.lvlAC_NOUser(U
    nknown Source)
    at com.orbitech.frameworks.bline.gen.BLineOS400CB_B1.invokeUserLvl(Unkno
    wn Source)
    at com.orbitech.frameworks.bline.gen.BLineOS400CB_B1.lvlAC_NO(Unknown So
    urce)
    at com.orbitech.frameworks.bline.gen.BLineOS400CB_B1.lvl(Unknown Source)
    at com.orbitech.frameworks.bline.gen.BLineOS400CB_B1.blineMainPolymorph(
    Unknown Source)
    at com.orbitech.frameworks.bline.engine.BLine.execute(Unknown Source)
    at com.orbitech.frameworks.bline.engine.BLine.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:484)
    01-08-03 11:59:53 | ERROR | [Thread4] | gen.BLineOS400CB_B1:lvlAC_NO | Error in
    lvlAC_NO.
    Please help... Do I need to change the JDBC driver. If Yes, which driver should I use.
    Regards,
    Mandar

    Try using
    ((OraclePreparedStatement)theStmt).setExecuteBatch(blocking factor);
    set the blocing factor to be something like 1000.
    The the above doesn't work by itself, then try adding the following after connection.
    ((OracleConnection)conn.setDefaultRowPrefetch(blocking factor);
    and then use the 1st statement.
    Hope it works.

  • Thin Driver throws SQLException instead of BatchUpdateExeption!

    Hi,
    I am using classes12.zip.
    While executing a batch update, one of the values in the prepared statement
    is invalid, so executeUpdate() fails. But, instead of throwing a
    java.sql.BatchUpdateException, the driver throws a java.sql.SQLException.
    This is a big problem for me since I handle BatchUpdateException to
    find out the erroneous value and so on.
    Please let me know if anybody else faced this problem, and what the solution is.
    TIA,
    Prasad

    At the time our issue was resolved, the bug was not published. And, I was told, there was no information in metalink about the isue. I am not sure whether they published some thing in the last few weeks.
    This is what resolved our issue.
    Step 1: alter system set java_jit_enabled=FALSE;
    Step 2: Try your test case. If it is the same issue as ours, your test case will be successful. If it succeeds, Go to step 3. If it does not succeed, it is a different issue.
    Step 3: alter system set java_jit_enabled=TRUE;
    Step 4: Run your test case. If it is the same issue, it is expected to fail. Go to Step 5 in case of failure.
    Step 5: Delete all rows from table java$mc$
    Step 6: Restart the database
    Step 7: Run your test case. It is expected to be successful.

  • Sybase jdbc throws Resource PermissionsException wls8.1 sp2

    HI,
    I just upgraded from wls 6.1 to wls 8.1 sp2. My Connection pools are not working
    anymore.
    I am using sybase server 11.5.1 with the jconnect 5. I am making database calls
    (that
    used to work). Here's the strange thing, I have a startup class that runs an
    sql query when weblogic server comes up (in the main thread i am assuming) and
    it works. But calling the same exact sql query fails when i click on my webapp
    that leads to the same query (it is called from a different thread).
    Any ideas? I am assuming it's a security issue where the main thread uses the
    correct username and password and the other threads don't. Heres my config file
    and my exception trace:
    <JDBCTxDataSource JNDIName="FOO" Name="MyJDBC Data Source"
    PoolName="MyJDBC Connection Pool-1" Targets="portal"/>
    <JDBCConnectionPool DriverName="com.sybase.jdbc2.jdbc.SybDriver"
    Name="MyJDBC Connection Pool-1" Password="xxx"
    Properties="user=vwap;url=jdbc:sybase:Tds:myhost:9501/vwap;networkProtocol=Tds;portNumber=9501;userName=vwap;databaseName=vwap;serverName=myhost"
    Targets="portal"
    TestTableName="SQL SELECT COUNT(*) FROM sysobjects" URL="jdbc:sybase:Tds:myhost:9501/vwap"/>
    I also tried it with weblogic sybase driver and same results:
    <JDBCConnectionPool DriverName="weblogic.jdbc.sybase.SybaseDriver"
    Name="MyJDBC Connection Pool" Password="xxx"
    Properties="user=vwap;url=jdbc:bea:sybase://myhost:9501;portNumber=9501;databaseName=vwap;serverName=myhost"
    Targets="portal"
    TestTableName="SQL SELECT COUNT(*) FROM sysobjects" URL="jdbc:bea:sybase://myhost:9501"/>
    error.weblogic.common.resourcepool.ResourcePermissionsException: User "<anonymous>"
    does not have permission to perform operation "reserve" on resource "MyJDBC Connection
    Pool-1" of application "null" of type "ConnectionPool"
    weblogic.jdbc.extensions.PoolPermissionsSQLException: weblogic.common.resourcepool.ResourcePermissionsException:
    User "<anonymous>" does not have permission to perform operation "reserve" on
    resource "MyJDBC Connection Pool-1" of application "null" of type "ConnectionPool"
         at weblogic.jdbc.common.internal.JDBCUtil.wrapAndThrowResourceException(JDBCUtil.java:157)
         at weblogic.jdbc.pool.Driver.connect(Driver.java:156)
         at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:444)
         at weblogic.jdbc.jts.Driver.connect(Driver.java:138)
         at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:305)
         at com.itginc.strategyServers.common.database.Database.initializeUserCache(Database.java:729)
         at com.itginc.strategyServers.common.database.Database.connect(Database.java:104)
         at com.itginc.strategyServers.common.database.Database.getClients(Database.java:157)
         at com.itginc.strategyServers.common.servlets.ClientsServlet.doPost(ClientsServlet.java:41)
         at com.itginc.strategyServers.common.servlets.BaseServlet.doGet(BaseServlet.java:110)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at com.itginc.strategyServers.common.servlets.BaseServlet.service(BaseServlet.java:53)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
         at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:301)
         at com.itginc.strategyServers.common.servlets.LoginServlet.doPost(LoginServlet.java:230)
         at com.itginc.strategyServers.common.servlets.LoginServlet.doGet(LoginServlet.java:242)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

    farnaz wrote:
    I changed the following line in my fileRealm.properties and fixed the problem.
    Is this the correct thing to do?
    acl.reserve.weblogic.jdbc.connectionPool=system
    changed to
    acl.reserve.weblogic.jdbc.connectionPool=everyoneyes.
    Joe
    >
    >
    >
    >
    "farnaz" <[email protected]> wrote:
    A few issues, i've been stuck on this problem for 2 days now, please
    HELP!
    1. My acl settings (i looked at them via the console) seems to have "everyone"
    permission for all jdbc operations: reserve, shrink, etc.
    2. If acl is not the way to set security policies why is it shown in
    the console?
    3. I cannot find anywhere in the wls8.1 documentation on how to set security
    policies
    for jdbc.
    Can i see an example?
    4. I was not using any java securtiy when i got that error, so then I
    added the
    -Djava.security.manager to my startup cmd line for starting weblogic
    using the
    default weblogic policy in $WLSHOME/server/lib/weblogic policy (unmodified)
    and
    got the following exception on startup, help!
    The Horizon Portal could not be started, because the Application Manager
    failed
    to initialize. access denied (java.lang.RuntimePermission weblogic.kernelPermission)
    java.security.AccessControlException: access denied (java.lang.RuntimePermission
    weblogic.kernelPermission)
         at java.security.AccessControlContext.checkPermission(AccessControlContext.java:270)
         at java.security.AccessController.checkPermission(AccessController.java:401)
         at weblogic.security.service.SubjectManagerImpl.checkKernelPermission(SubjectManagerImpl.java:202)
         at weblogic.security.service.SubjectManagerImpl.getKernelIdentity(SubjectManagerImpl.java:181)
         at weblogic.security.subject.SubjectManager.isKernelIdentity(SubjectManager.java:102)
         at weblogic.security.service.SubjectManagerImpl.checkKernelIdentity(SubjectManagerImpl.java:214)
         at weblogic.security.subject.DelegatingSubjectStack.getCurrentSubject(DelegatingSubjectStack.java:31)
         at weblogic.security.service.SubjectManagerImpl.getCurrentSubject(SubjectManagerImpl.java:61)
         at weblogic.security.service.SecurityManager.getCurrentSubject(SecurityManager.java:43)
         at weblogic.jndi.internal.ServerNamingNode.checkPermission(ServerNamingNode.java:330)
         at weblogic.jndi.internal.ServerNamingNode.checkModify(ServerNamingNode.java:306)
         at weblogic.jndi.internal.ServerNamingNode.rebindHere(ServerNamingNode.java:166)
         at weblogic.jndi.internal.BasicNamingNode.rebind(BasicNamingNode.java:382)
         at weblogic.jndi.internal.WLEventContextImpl.rebind(WLEventContextImpl.java:118)
         at javax.naming.InitialContext.rebind(InitialContext.java:363)
         at com.itginc.strategyServers.common.database.DatabaseLookup.bind(DatabaseLookup.java:45)
         at com.itginc.strategyServers.horizon.services.AppManager.Initialize(AppManager.java:66)
         at com.itginc.strategyServers.horizon.services.AppManager.<init>(AppManager.java:44)
         at com.itginc.strategyServers.horizon.services.AppManager.makeClass(AppManager.java:22)
         at com.itginc.strategyServers.horizon.services.Startup.startup(Startup.java:27)
         at weblogic.t3.srvr.StartupClassService.invokeStartup(StartupClassService.java:177)
         at weblogic.t3.srvr.StartupClassService.invokeClass(StartupClassService.java:158)
         at weblogic.t3.srvr.StartupClassService.access$000(StartupClassService.java:36)
         at weblogic.t3.srvr.StartupClassService$1.run(StartupClassService.java:121)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
         at weblogic.t3.srvr.StartupClassService.invokeStartupClass(StartupClassService.java:116)
         at weblogic.t3.srvr.PostDeploymentStartupService.resume(PostDeploymentStartupService.java:22)
         at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
         at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:964)
         at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:359)
         at weblogic.Server.main(Server.java:32)
    Joe Weinstein <[email protected]> wrote:
    Hi. Two things:
    Your test table SQL is wasteful. sysobjects is a big table. No needto
    count everything
    in it every time to check the connections. Try "SQL select 1" for abetter
    one.
    The problem isn't in the pool definition. It's a security issue. You
    should edit your
    weblogic.policy file to allow jdbc access to everyone.
    Joe
    farnaz wrote:
    HI,
    I just upgraded from wls 6.1 to wls 8.1 sp2. My Connection pools
    are
    not working
    anymore.
    I am using sybase server 11.5.1 with the jconnect 5. I am making
    database
    calls
    (that
    used to work). Here's the strange thing, I have a startup class thatruns an
    sql query when weblogic server comes up (in the main thread i am assuming)and
    it works. But calling the same exact sql query fails when i clickon my webapp
    that leads to the same query (it is called from a different thread).
    Any ideas? I am assuming it's a security issue where the main threaduses the
    correct username and password and the other threads don't. Heres
    my
    config file
    and my exception trace:
    <JDBCTxDataSource JNDIName="FOO" Name="MyJDBC Data Source"
    PoolName="MyJDBC Connection Pool-1" Targets="portal"/>
    <JDBCConnectionPool DriverName="com.sybase.jdbc2.jdbc.SybDriver"
    Name="MyJDBC Connection Pool-1" Password="xxx"
    Properties="user=vwap;url=jdbc:sybase:Tds:myhost:9501/vwap;networkProtocol=Tds;portNumber=9501;userName=vwap;databaseName=vwap;serverName=myhost"
    Targets="portal"
    TestTableName="SQL SELECT COUNT(*) FROM sysobjects" URL="jdbc:sybase:Tds:myhost:9501/vwap"/>
    I also tried it with weblogic sybase driver and same results:
    <JDBCConnectionPool DriverName="weblogic.jdbc.sybase.SybaseDriver"
    Name="MyJDBC Connection Pool" Password="xxx"
    Properties="user=vwap;url=jdbc:bea:sybase://myhost:9501;portNumber=9501;databaseName=vwap;serverName=myhost"
    Targets="portal"
    TestTableName="SQL SELECT COUNT(*) FROM sysobjects" URL="jdbc:bea:sybase://myhost:9501"/>
    error.weblogic.common.resourcepool.ResourcePermissionsException: User"<anonymous>"
    does not have permission to perform operation "reserve" on resource"MyJDBC Connection
    Pool-1" of application "null" of type "ConnectionPool"
    weblogic.jdbc.extensions.PoolPermissionsSQLException: weblogic.common.resourcepool.ResourcePermissionsException:
    User "<anonymous>" does not have permission to perform operation "reserve"on
    resource "MyJDBC Connection Pool-1" of application "null" of type
    "ConnectionPool"
         at weblogic.jdbc.common.internal.JDBCUtil.wrapAndThrowResourceException(JDBCUtil.java:157)
         at weblogic.jdbc.pool.Driver.connect(Driver.java:156)
         at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:444)
         at weblogic.jdbc.jts.Driver.connect(Driver.java:138)
         at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:305)
         at com.itginc.strategyServers.common.database.Database.initializeUserCache(Database.java:729)
         at com.itginc.strategyServers.common.database.Database.connect(Database.java:104)
         at com.itginc.strategyServers.common.database.Database.getClients(Database.java:157)
         at com.itginc.strategyServers.common.servlets.ClientsServlet.doPost(ClientsServlet.java:41)
         at com.itginc.strategyServers.common.servlets.BaseServlet.doGet(BaseServlet.java:110)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at com.itginc.strategyServers.common.servlets.BaseServlet.service(BaseServlet.java:53)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
         at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:301)
         at com.itginc.strategyServers.common.servlets.LoginServlet.doPost(LoginServlet.java:230)
         at com.itginc.strategyServers.common.servlets.LoginServlet.doGet(LoginServlet.java:242)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
         at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
         at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
         at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
         at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
         at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
         at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)

  • Throws Exception when jdbc connect to Oracle

    Hi! I'm waiting for your answers.
    When i use jdbc to connect Oracle,system throws exceptions as follows:
    java.lang.ClassCastException: oracle.sql.converter.CharacterConverter12Byte
    oracle.sql.CharacterSet1Byte oracle.sql.CharacterSet1Byte.getInstance (int,racle.sql.converter.CharacterConverter)
              CharacterSet1Byte.java:82
         oracle.sql.CharacterSet oracle.sql.CharacterSetWithConverter.getInstance(int)     CharacterSetWithConverter.java:85
    I code in Oracle9i Jdeveloper 9.0.2. The Oracle version is 9.0.2.
    My code example is as follows:
    package mypackage2;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    public class Class1
    public Class1()
    public static void main(String[] args)
    Class1 class1 = new Class1();
    Connection conn = null;
    try
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    //exception throws in getConnection()
    conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@localhost:1521:CR","system","CR2001");
    catch (Exception e)
    e.printStackTrace();

    import java.io.*;
    import java.sql.*;
    import java.text.*;
    import oracle.jdbc.driver.*;
    public class viewtable
         Connection con;
         Statement st;
         public viewtable (String args[]) throws ClassNotFoundException,FileNotFoundException,IOException,SQLException
         url="jdbc:oracle:thin:system/manager@IP:1521:SID";
         Class.forName ("oracle.jdbc.driver.OracleDriver");
         try
         con=DriverManager.getConnection(url);
              st = con.createStatement ();
              doexample ();
              st.close ();
              con.close ();
         }catch(SQLException e)
              System.err.println(e.getMessage());
         public void doexample () throws SQLException
         ResultSet rs = st.executeQuery("select * from sales");
              if(rs!=null) {
              while(rs.next())
                   int a = rs.getInt("no");                    System.out.println("NO = "+a);
              rs.close();
         public static void main (String args[])
              System.out.println ("Oracle Exercise 1 \n");
              try
                   viewtable test = new viewtable(args);
              } catch (Exception ex)
                   System.err.println ("Exception caught.\n"+ex);
                   ex.printStackTrace ();
    the above is the full code, please check the problem....many thanks

  • Why it throws the SQLException

    hi guys,
    the following is the fragment of the program, and when i run it, it throws a SQLException, and first i though it is the String sql statement, but after i try many tims to modify it, it still throws SQLException.
    so could someone help me out of it...
    thank you
    boolean login(String userName, String password) {
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con =
    DriverManager.getConnection("jdbc:odbc:JavaWeb");
    System.out.println("got connection");
    Statement s = con.createStatement();
    String sql = "SELECT UserName, Password FROM Users" +
    " WHERE UserName='" + userName + "'" +
    " AND Password='" + password + "'";
    ResultSet rs = s.executeQuery(sql);
    if (rs.next()) {
    rs.close();
    s.close();
    con.close();
    return true;
    rs.close();
    s.close();
    con.close();
    catch (ClassNotFoundException e) {
    System.out.println(e.toString());
    catch (SQLException e) {
    System.out.println(e.toString());
    catch (Exception e) {
    System.out.println(e.toString());
    return false;
    }

    And what about posting this in the JDBC forum? It
    doesn't seem to have anything to do with servlets.They did post it to the JDBC section... #*&% cross post.

  • Query works in Oracle Client but not JDBC

    The query is as follows:
    SELECT COUNT(*) THE_COUNT FROM sentorders WHERE ordersentdate BETWEEN '15-JAN-01' and '15-JAN-03';When I run this query in the Oracle client (SQL+) it tells me that THE_COUNT is 4 which is correct but when I use the following JDBC code I get THE_COUNT is 0 which is incorrect.
    public ResultSet viewTotalSentOrdersByDate()
      throws SQLException, Exception {
          String beginDate = "15-JAN-01";
          String endDate = "15-JAN-03";
          ResultSet rs = null;
        try  {
          String queryString = ("SELECT COUNT(*) THE_COUNT FROM sentorders WHERE ordersentdate BETWEEN '" + beginDate + "' and '" + endDate + "'");
          System.out.println(queryString);
          Statement stmt = con.createStatement();
          rs = stmt.executeQuery(queryString);
          while(rs.next()) {
           System.out.println(rs.getString("THE_COUNT"))
        } catch (SQLException sqle) {
          error = "SQLException: Could not execute the query.";
          throw new SQLException(error);
        } catch (Exception e) {
          error = "An exception occured.";
          throw new Exception(error);               
        return rs;
      }Thanks for the help
    Zac

    The query is as follows:
    SELECT COUNT(*) THE_COUNT FROM sentorders WHERE ordersentdate BETWEEN '15-JAN-01' and '15-JAN-03';When I run this query in the Oracle client (SQL+) it tells me that THE_COUNT is 4 which is correct but when I use the following JDBC code I get THE_COUNT is 0 which is incorrect.
    public ResultSet viewTotalSentOrdersByDate()
    throws SQLException, Exception {
    String beginDate = "15-JAN-01";
    String endDate = "15-JAN-03";
    ResultSet rs = null;
    try {
    String queryString = ("SELECT COUNT(*) THE_COUNT FROM sentorders WHERE ordersentdate BETWEEN '" + beginDate + "' and '" + endDate + "'");
    System.out.println(queryString);
    Statement stmt = con.createStatement();
    rs = stmt.executeQuery(queryString);
    while(rs.next()) {
    System.out.println(rs.getString("THE_COUNT"))
    } catch (SQLException sqle) {
    error = "SQLException: Could not execute the query.";
    throw new SQLException(error);
    } catch (Exception e) {
    error = "An exception occured.";
    throw new Exception(error);
    return rs;
    }Thanks for the help
    Zac

  • JDBC MS Access--- cannot extract entry with null value with data type Meta

    I'm trying to extract a data entry with null value by using JDBC. The database is MS Access.
    The question is how to extract null entry with data type memo? The following code works when the label has data type Text, but it throws sqlException when the data type is memo.
    Any advice will be appreciated! thanks!
    Following are the table description and JDBC code:
    test table has the following attributes:
    Field name Data Type
    name Text
    label Memo
    table contents:
    name label
    me null
    you gates
    Code:
    String query = "SELECT name, label FROM test where name like 'me' ";
    ResultSet rs = stmt.executeQuery(query);
    while (rs.next())
    String name = rs.getString("name");
    rs.getString("val");
    String label = rs.getString("label");
    System.out.println("\t"+name+"\t"+label);
    catch (SQLException ex)
    System.out.println(ex.getSQLState());
    System.out.println(ex.getErrorCode());
    System.out.println("in sqlexception");
    output:
    C:\Temp\SEFormExtractor>java DBTest
    yet SELECT name, label FROM test
    null
    0
    in sqlexception

    The question is how to extract null entry with data type memo?Okay, what you need to do is this:
    if (rs.getString("val") == null)
      // do something
    }This way, when it's a null value, you can check it first, and then handle it how you want, rather than getting an exception.

  • Oracle:JDBC Call returns no results, SQL*Plus returns 1 record, Please help

    Any help would be greatly appreciated.
    Running 9.2.0.5.0, and using latest 9.2 JDBC 1.4_g drivers in thin mode.
    Execute the following query from SQL*Plus and it returns one row, from JDBC using a PreparedStatement, I get no results. Here's the query, table def, record, etc.:
    Query:
    SELECT
    ID_WEB_FRM,ID_WEB_SIT,CDE_LVL_1_FUNC,
    CDE_LVL_2_FUNC,NUM_WEB_FUNC_PG,NUM_WEB_PG_ID
    FROM
    WEB_FRM
    WHERE
    ID_WEB_FRM = ' '
    OR
    (ID_WEB_SIT = 'test' AND CDE_LVL_1_FUNC = ' '
    AND CDE_LVL_2_FUNC = 'u2T' AND NUM_WEB_FUNC_PG = 1
    AND NUM_WEB_PG_ID = 0)
    Record returned from SQL*Plus:
    ID_WEB_FRM ID_WEB_SIT CDE CDE NUM_WEB_FUNC_PG NUM_WEB_PG_ID
    NfRRmc5XZu test u2T 1 0
    Both in the data returned and the query, there are no blanks, but they are a single space instead (hard to see in message here).
    Java code:
    int count = 1;
    findDBNameStatement.setString(count++," ");
    findDBNameStatement.setString(count++,form.getSiteID());
    findDBNameStatement.setString(count++," ");
    findDBNameStatement.setString(count++, form.getFunctionID());
    findDBNameStatement.setInt(count++,form.getPageNumber());
    findDBNameStatement.setInt(count++,form.getSectionNumber());
    ResultSet resultSet = findDBNameStatement.executeQuery();
    ResultSetMetaData metaData = resultSet.getMetaData();
    resultSet.next() returns false
    DB table:
    CREATE TABLE web_frm (
    ID_WEB_FRM varchar2(10) NOT NULL,
    ID_WEB_SIT varchar2(20) NOT NULL,
    NAM_WEB_FRM varchar2(40),
    TXT_EMAIL_SUBJ varchar2(50),
    CDE_LVL_1_FUNC char(3),
    CDE_LVL_2_FUNC char(3) NOT NULL,
    NUM_WEB_FUNC_PG int NOT NULL,
    NUM_WEB_PG_ID smallint NOT NULL,
    DTE_WEB_FRM_EFF date NOT NULL,
    DTE_WEB_FRM_TRM date,
    CDE_VLDT_RUL char(3),
    DTE_LAST_EXPRT date,
    TXT_CNFRMN_MSG varchar2(4000),
    IND_UPDT_ALWD char(1) NOT NULL,
    TXT_RECAP_HDR varchar2(4000),
    TXT_RECAP_FTR varchar2(4000),
    CDE_WEB_OBJ char(3),
    NUM_MAX_FRM_WIDTH number(4,0),
    IND_RECAP_PG char(1) NOT NULL,
    IND_CNFRM_PG char(1) NOT NULL,
    IND_DSPL_CNFRM_NUM char(1) NOT NULL,
    CNT_SUBM_MAX int,
    TXT_CHCE_ADD_MSG varchar2(255),
    TXT_CHCE_MOD_MSG varchar2(255),
    TXT_WEB_HDR varchar2(4000),
    TXT_WEB_FTR varchar2(4000),
    TXT_WAIT_LIST_MSG varchar2(255),
    FORMOBJECTHEIGHT int NOT NULL,
    FORMOBJECTWIDTH int NOT NULL
    ALTER TABLE web_frm ADD ( CONSTRAINT PK_web_frm PRIMARY KEY (ID_WEB_FRM));
    ALTER TABLE web_frm ADD ( CONSTRAINT UK_web_frm UNIQUE (ID_WEB_SIT,CDE_LVL_1_FUNC,CDE_LVL_2_FUNC,NUM_WEB_FUNC_PG,NUM_WEB_PG_ID)) ;
    Thanks,
    Matt

    That's not quite right. From the javadocs:
    next
    public boolean next()
    throws SQLException
    Moves the cursor down one row from its current position. A ResultSet cursor is initially positioned before the first row; the first call to the method next makes the first row the current row; the second call makes the second row the current row, and so on.
    If an input stream is open for the current row, a call to the method next will implicitly close it. A ResultSet object's warning chain is cleared when a new row is read.
    Returns:
    true if the new current row is valid; false if there are no more rows
    Throws:
    SQLException - if a database access error occurs

Maybe you are looking for

  • Wacom tablet pressure sensitivity, dont work outside canvas

    Hi. I wonder, if i'm the only one, who are having problems to start a stroke outside the canvas and follow it on the canvas, without the pressure sensitivity is all on max. seems the same is happing, if you have marked an area and start at stroke out

  • Update Excel to sharepoint and edit the data.

    Hi experts, Happy New Year to all, I would like to know is it possible to update my excel sheet having 10 different fields (Columns) to share point, and edit them as a list. Want to know step by step procedure. My requirement is as below I want to up

  • Authenticated on ISE 1.2 (as admin) against an external radius server

    Hello Our customer wants to be authenticated on ISE 1.2 (as admin) against an external radius server (like ACS not microsoft). How could i do that ? Is it possible while retaining internal admin users database in a sequence "external_radius or intern

  • Problems when creating an extraction view

    Hello, We have to create a transaction data datasource based on a transparent table ZTABLE. Unfortunatly, the error message R8359 occured : "You tried to generate an extract structure with the template structure ZTABLE. This operation failed, because

  • Change workspace via applescript?

    I'm constantly switching between hooking my laptop to a big monitor and working on its internal screen in a cafe or whatever. And I'm getting really tired of constantly having to do "window->workspace->some workspace" followed by "window->workspace->