Return-Path: Delivered-To: apmail-incubator-beehive-user-archive@www.apache.org Received: (qmail 11545 invoked from network); 24 Jan 2005 20:44:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 24 Jan 2005 20:44:13 -0000 Received: (qmail 61125 invoked by uid 500); 24 Jan 2005 20:44:11 -0000 Delivered-To: apmail-incubator-beehive-user-archive@incubator.apache.org Received: (qmail 61104 invoked by uid 500); 24 Jan 2005 20:44:11 -0000 Mailing-List: contact beehive-user-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Beehive Users" Delivered-To: mailing list beehive-user@incubator.apache.org Received: (qmail 61089 invoked by uid 99); 24 Jan 2005 20:44:11 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from ussjmh01.bea.com (HELO ussjmh01.bea.com) (63.96.162.5) by apache.org (qpsmtpd/0.28) with ESMTP; Mon, 24 Jan 2005 12:44:10 -0800 Received: from ussjfe02.amer.bea.com (ussjfe02b.bea.com [172.16.120.56]) by ussjmh01.bea.com (Switch-3.0.5/Switch-3.0.0) with ESMTP id j0OKi827025131 for ; Mon, 24 Jan 2005 12:44:08 -0800 Received: from USBOEX01.amer.bea.com ([10.36.32.15]) by ussjfe02.amer.bea.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 24 Jan 2005 12:44:08 -0800 Received: from [10.36.33.228] ([10.36.33.228]) by USBOEX01.amer.bea.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 24 Jan 2005 13:44:08 -0700 Message-ID: <41F55E7D.2030300@bea.com> Date: Mon, 24 Jan 2005 13:45:49 -0700 From: "Eddie O'Neil" User-Agent: Mozilla Thunderbird 1.0RC1 (Windows/20041201) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Beehive Users Subject: Re: Exception caught: Invalid argument name in SQL statement References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 24 Jan 2005 20:44:08.0040 (UTC) FILETIME=[7355B680:01C50255] X-PMX-Version: 4.7.0.111621, Antispam-Engine: 2.0.2.0, Antispam-Data: 2005.1.24.8 X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N I'll put another plug in for this... There's also a full-featured JDBC control being built here: http://jdbc.controlhaus.org The one in the Beehive tree is really just a tutorial / sample for how to build an extensible control. Hope that helps. :) Eddie Timothy Brown wrote: > That seems to have worked. > > Thanks, > > Tim > > -----Original Message----- > From: Chris Copeland [mailto:ccopeland@motive.com] > Sent: Monday, January 24, 2005 2:53 PM > To: Beehive Users > Subject: RE: Exception caught: Invalid argument name in SQL statement > > I don't see this in any of the Beehive documentation, but I think the > problem is in your parameter substitution. You can't have spaces within > curly braces. > > Your Code: > @SQL(statement="SELECT employee_id, first_name, last_name FROM EMPLOYEE > WHERE employee_id={ i }") > > Should Be: > @SQL(statement="SELECT employee_id, first_name, last_name FROM EMPLOYEE > WHERE employee_id={i}") > > Here is the relevant BEA WebLogic Workshop documentation. I'm assuming > that the Beehive Database Control is the same. > http://e-docs.bea.com/workshop/docs81/doc/en/workshop/guide/controls/dat > abase/conParameterSubstitutionInJwsSqlStatements.html?skipReload=true > > > Chris > > -----Original Message----- > From: Timothy Brown [mailto:tbrownagc@earthlink.net] > Sent: Monday, January 24, 2005 1:04 PM > To: beehive-user@incubator.apache.org > Subject: Exception caught: Invalid argument name in SQL statement > > I am getting this error and have no idea where to troubleshoot. I know > the > sql statement is correct..I have the latest code from svn compiled and > deployed. > > > > Any ideas? > > > > Thanks, > > > > Tim > > > > > > Employee.jsp > > > > <%@ page language="java" contentType="text/html;charset=UTF-8"%> > > <%@ taglib uri="http://beehive.apache.org/netui/tags-html-1.0" > prefix="netui"%> > > > > > > Employee Test Page > > > > > > id="empMgr" > scope="session"/> > >

> > Response from the selectEmployee() method on the Employee > Manager > Control: <%= empMgr.selectEmployee() %> > >

> >

> > Response from the getEmployee() method on the Employee Manager > Control: <%= empMgr.getEmployee() %> > >

> > > >
> >
> > > > > > > > EmployeeDBControl.jcx > > > > package controls.employee; > > > > import java.sql.SQLException; > > import java.sql.ResultSet; > > > > import java.io.Serializable; > > > > import java.util.Iterator; > > import java.util.HashMap; > > > > import org.apache.beehive.controls.api.bean.ControlExtension; > > > > import dbControl.DatabaseControl; > > import dbControl.DatabaseControl.ConnectionDataSource; > > import dbControl.DatabaseControl.SQL; > > > > @ControlExtension > > @ConnectionDataSource(jndiName="jdbc:hsqldb:hsql://localhost, sa") > > public interface EmployeeDBControl extends DatabaseControl > > { > > @SQL(statement="SELECT employee_id, first_name, last_name FROM > EMPLOYEE > WHERE employee_id={ i }") > > public Employee selectEmployee( int i ) throws SQLException; > > > > // > > // get all rows from the EMPLOYEE table, returned as a > java.sql.ResultSet > > // > > @SQL(statement="SELECT * FROM EMPLOYEE") > > public ResultSet getAllEmployees() throws SQLException; > > > > } > > > > EmployeeManagerImpl.jcs > > > > package controls.employee; > > > > import org.apache.beehive.controls.api.bean.*; > > import java.sql.SQLException; > > import java.rmi.RemoteException; > > > > import java.sql.Connection; > > import java.sql.DriverManager; > > import java.sql.Statement; > > import java.sql.ResultSet; > > > > import javax.sql.DataSource; > > import javax.naming.InitialContext; > > import javax.naming.Context; > > > > > > @ControlImplementation > > public class EmployeeManagerImpl implements EmployeeManager > > { > > > > @Control EmployeeDBControl employeeDB; > > > > Employee emp = null; > > > > > > // default no-arg constructor > > public EmployeeManagerImpl(){} > > > > public String getEmployee() > > { > > return "Change to Employee control"; > > } > > > > public String getAllEmployees() > > { > > String sRetVal = "nada"; > > ResultSet rs = null; > > try > > { > > System.out.println( "EmployeeManagerImpl: Calling > employeeDB.getAllEmployees..." ); > > rs = employeeDB.getAllEmployees(); > > //Customer[] customers jdbcCtrl.getCustomerArray(); > > > > if( rs.next() ) > > { > > sRetVal = "We have data in the result set" ; > > } > > } > > catch( SQLException sqle ) > > { > > // TODO > > System.out.println( sqle.getMessage() ); > > } > > return sRetVal; > > } > > > > public String selectEmployee() > > { > > > > String sRetVal = "Something is wrong -- Returned > from selectEmployee in EmployeeManagerImpl"; > > > > try > > { > > System.out.println("EmployeeManagerImpl: Attemping to call > employeeDB.selectEmployee( 100 ) "); > > emp = employeeDB.selectEmployee( 100 ); > > System.out.println("EmployeeManagerImpl: Fininshed calling > employeeDB.selectEmployee( 100 ) "); > > } > > catch( SQLException sqle ) > > { > > sRetVal = "SQLException caught: " + > sqle.getMessage(); > > } > > > > catch( Exception e ) > > { > > sRetVal = "Exception caught: " + e.getMessage(); > > } > > > > if ( null != emp ) > > { > > sRetVal = emp.toString(); > > System.out.println("sRetVal contains data: " + > sRetVal ); > > } > > > > return sRetVal; > > } > > > > > > > > > > > > public String testDriverMgrConnection() throws Exception > > { > > String sRetVal = "Nada"; > > > > int iEmpId = 0; > > String foo = "Not Connected"; > > String bar = "No Last Name"; > > /* > > Class.forName("org.hsqldb.jdbcDriver"); > > > > // add authentication and test > > Connection conn = > DriverManager.getConnection("jdbc:hsqldb:hsql://localhost, sa"); > > Statement s = conn.createStatement(); > > > > if ( conn != null ) > > { > > System.out.println("Conn is not null in > testDriverMgrConnection"); > > sRetVal = "conn is not null"; > > } > > > > conn.close(); > > s = null; > > > > */ > > > > try > > { > > Context initCtx = new InitialContext(); > > if(initCtx == null ) > > throw new Exception("Boom - No Context"); > > > > //DataSource ds = > > > //(DataSource)initCtx.lookup("java:comp/env/com.bea.EventTracker"); > > > > Context envCtx = (Context) > initCtx.lookup("java:comp/env"); > > DataSource ds = (DataSource) > > envCtx.lookup("com.bea.EventTracker"); > > > > > if (ds != null) > > { > > Connection conn = ds.getConnection(); > > > > if(conn != null) > > { > > foo = "Got Connection "+conn.toString(); > > Statement stmt = conn.createStatement(); > > ResultSet rst = > > stmt.executeQuery( > > "select employee_id, last_name, first_name from > employee"); > > if(rst.next()) > > { > > iEmpId = rst.getInt(1); > > foo = rst.getString(2); > > bar = rst.getString(3); > > > > sRetVal = iEmpId + " " + bar + " "+ foo ; > > } > > conn.close(); > > } > > } > > }catch(Exception e) > > { > > //e.printStackTrace(); > > sRetVal = e.getMessage(); > > } > > > > return sRetVal; > > > > } > > > > } > > > > EmployeeManager.java > > > > package controls.employee; > > > > import org.apache.beehive.controls.api.bean.ControlInterface; > > import java.sql.SQLException; > > import java.sql.ResultSet; > > > > @ControlInterface > > public interface EmployeeManager > > { > > public String getEmployee(); > > > > public String selectEmployee(); > > > > public String testDriverMgrConnection() throws Exception; > > > > public String getAllEmployees() throws SQLException; > > > > } > > > >