Bugs item #424768, was opened at 2001-05-17 00:29
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=424768&group_id=22866

Category: JBossServer
Group: v2.2.1 (stable)
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Oscar Radio Pina (oradio)
Assigned to: Andreas Schaefer (schaefera)
Summary: prepareStatement parameters

Initial Comment:
When you try to set ResultSet.TYPE_SCROLL_INSENSITIVE, 
ResultSet.CONCUR_READ_ONLY properties to a 
PreparedStatemt object, it doesn't works. The 
following code shows the bug: 

        prepareStatement = con.prepareStatement
(this.stringSQL, ResultSet.TYPE_SCROLL_INSENSITIVE, 
ResultSet.CONCUR_READ_ONLY);    
            
        if (prepareStatement.getResultSetType() == 
java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE)
        {
                System.out.println
("TYPE_SCROLL_INSENSITIVE");
        }      
        else
        {
                System.out.println("not 
TYPE_SCROLL_INSENSITIVE");
        }


Output results:

        jboss2.0: TYPE_SCROLL_INSENSITIVE
        
        jboss2.2.1: not TYPE_SCROLL_INSENSITIVE


The same code using a Statement instead of a 
PreparedStatemt works. I find this code in the 
jbosspool:

In the org.jboss.pool.jdbc.xa.XAClientConnection class:

    public Statement createStatement(int 
resultSetType, int resultSetConcurrency) throws 
SQLException {
        if(con == null) throw new SQLException(CLOSED);
        try {
            StatementInPool st = new StatementInPool
(con.createStatement(resultSetType, 
resultSetConcurrency), this);
            statements.add(st);
            return st;
        } catch(SQLException e) {
            setError(e);
            throw e;
        }
    }

    public PreparedStatement prepareStatement(String 
sql, int resultSetType, int resultSetConcurrency) 
throws SQLException {
        return prepareStatement(sql);
    }

    public PreparedStatement prepareStatement(String 
sql) throws SQLException {
        if(con == null) throw new SQLException(CLOSED);
        try {
            PreparedStatement ps = (PreparedStatement)
preparedStatementCache.useObject(sql);
            if(ps == null)
                throw new SQLException("Unable to 
create PreparedStatement!");
            PreparedStatementInPool wrapper = new 
PreparedStatementInPool(ps, this, sql);
            statements.add(wrapper);
            return wrapper;
        } catch(SQLException e) {
            setError(e);
            throw e;
        }
    }


So when you call the constructor of the class with the 
three parameters it calls the constructor only with 
one parameter the SQL string. But the same code using 
createStatement works.

I'm using JBoss 2.2.1 JVM 1.3, win2k

The category I choose is JBoss if this bug it is of 
other category please tell me and I will change it.


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=424768&group_id=22866

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to