SQL Servers 7.0 stored procedures & obscure SQLException messages

Ermin Hasicevic ermin at iskon.hr
Mon Aug 21 05:34:14 EDT 2000


Hi!

I get an obscure SQLException message when I try to call
stored procedure in MS SQL Server 7.0. The message is
as follows:

java.sql.SQLException: Protocol confusionFound a 
com.internetcds.jdbc.tds.PacketErrorResult (packet type 0xaa)
¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨
        at 
com.internetcds.jdbc.tds.PreparedStatement_base.executeCall(PreparedStatement_base.java, 
Compiled Code)
        at 
com.internetcds.jdbc.tds.CallableStatement_base.execute(CallableStatement_base.java, 
Compiled Code)
        at 
com.internetcds.jdbc.tds.PreparedStatement_base.executeUpdate(PreparedStatement_base.java, 
Compiled Code)
        at hr.iskon.sql.DB.MyCallable1(DB.java, Compiled Code)
        at hr.iskon.klik.anketa.Anketa.insertAnswer(Anketa.java, Compiled 
Code)
        at 
has._0002fhas_0002fAnketa_0002ejspAnketa_jsp_44._jspService(_0002fhas_0002fAnketa_0002ejspAnketa_jsp_44.java, 
Compiled Code)
        at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java, 
Compiled Code)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java, 
Compiled Code)
        at 
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java, 
Compiled Code)
        at 
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java, 
Compiled Code)
        at org.apache.jasper.runtime.JspServlet.service(JspServlet.java, 
Compiled Code)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java, 
Compiled Code)
        at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java, 
Compiled Code)
        at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java, Compiled 
Code)
        at 
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection(Ajp12ConnectionHandler.java, 
Compiled Code)
        at 
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java, 
Compiled Code)
        at java.lang.Thread.run(Thread.java, Compiled Code)

The Java method that handles calls to stored procedure is 
following:

 public static int MyCallable1(String sp,Object[] array, String dbname) 
throws Exception {

                connMgr = DBConnectionManager.getInstance();
                Connection conn = connMgr.getConnection(dbname);

                if ( conn == null) {
                       Logging.log( new Exception(), "DB:int MyCallable1 -- 
conn==null");
                       throw new Exception();
                }
                if (sp == null) {
                        Logging.log( new Exception(), "DB:int MyCallable1 
-- sp==null");
                        throw new IllegalArgumentException("stored 
procedure not specified");
                }
                 
                int iReturned = -1;
               
                CallableStatement cst = conn.prepareCall("{ "+sp+" }");

                if ( array != null ) {
                    String className = null;
                    for (int i=0; i< array.length; i++) {
                         className = array[i].getClass().getName();
                         if ( className.equals("java.lang.String") ) {
                                cst.setString(i+1, (String) array[i]);
                         } else if ( className.equals("java.lang.Integer") 
) {
                                cst.setInt(i+1, ((Integer) 
array[i]).intValue());
                         }
                    }
                }
                try {
                        iReturned = cst.executeUpdate();
                } catch (SQLException e) {
                        Logging.log(e, "DB: int MyCallable1" );
                }
                 
                connMgr.freeConnection(dbname, conn);

                return iReturned;}

Probably it's an idiotic mistake, but I can't figure it out
what's the catch with this :-) So if anybody got any 
idea please do not hesitate to come up with your opininion.

Tnx in advance.

Ermin



More information about the FreeTDS mailing list