Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: need help getting a sql query embedde in java to work

Re: need help getting a sql query embedde in java to work

From: C. Ferguson <c_ferguson_at_rationalconcepts.com>
Date: 2000/05/18
Message-ID: <392452A1.D92FE70F@rationalconcepts.com>#1/1

Hi,
  Is this a cut and paste error on your part?

...WHERE Playson.teamname = '"+ teamName + "'"; AND players.firstname = playson.firstname;";

It should read: "....WHERE Playson.teamname = '" + teamName + "' AND players.firstname = playson.firstname";

Now, enter the query in SQLPlus and debug from that end.

hth,
cindy

"Adam C." wrote:

> I'm getting the following exception when trying to run this query on the
> tables with the following schema I can't figure out why can anyone help.
> java.sql.SQLException: Invalid column name
>
> query = "SELECT Players.firstname, Players.lastname, Players.jerseynumber,
> Players.touchdowns, "+
> "Players.rushingyards, Players.passingyards,
> Players.receivingyards, Players.interceptionsthrown, "+
> "Players.interceptionscaught, Players.fumbles,
> Players.recoveries, Players.sacks " +
> "FROM Players, Playson WHERE Playson.teamname = '"+ teamName +
> "'"; AND players.firstname = playson.firstname;";
>
> try
> {
> Connection dbConnection = getDatabaseConnection();
> Statement statement = dbConnection.createStatement();
> ResultSet result = statement.executeQuery(query);
>
> SELECT Players.firstname, Players.lastname, Players.jerseynumber,
> Players.touchdowns, Players.rushingyards, Players.passingyards,
> Players.receivingyards, Players.interceptionsthrown,
> Players.interceptionscaught, Players.fumbles, Players.recoveries,
> Players.sacks FROM Players, Playson WHERE Playson.teamname = 'New England
> Patriots'
>
> describe players
> Name Null? Type
> ----------------------------------------- -------- -------------------------
> ---
> FIRSTNAME NOT NULL VARCHAR2(15)
> LASTNAME NOT NULL VARCHAR2(20)
> JERSEYNUMBER NOT NULL NUMBER(38)
> POSITION NOT NULL VARCHAR2(15)
> TOUCHDOWNS NUMBER(38)
> RUSHINGYARDS NUMBER(38)
> PASSINGYARDS NUMBER(38)
> RECEIVINGYARDS NUMBER(38)
> INTERCEPTIONSTHROWN NUMBER(38)
> INTERCEPTIONSCAUGHT NUMBER(38)
> FUMBLES NUMBER(38)
> RECOVERIES NUMBER(38)
> SACKS NUMBER(38)
>
> describe playson
> Name Null? Type
> ----------------------------------------- -------- -------------------------
> ---
> TEAMNAME NOT NULL VARCHAR2(30)
> FIRSTNAME NOT NULL VARCHAR2(15)
> LASTNAME NOT NULL VARCHAR2(20)
> POSITION NOT NULL VARCHAR2(15)
Received on Thu May 18 2000 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US