Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 4th, 2003, 08:43 AM
jcarlos jcarlos is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 10 jcarlos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 12 m 16 sec
Reputation Power: 0
SQL in a Servlet

The next query donīt run:

String query = "SELECT AUTHORS.AU_LNAME, AUTHORS.AU_FNAME, TITLES.TITLE, TITLES.PRICE, TITLES.TITLE_ID FROM AUTHORS, TITLEAUTHOR, TITLES" +
" WHERE TITLES.TITLE_ID = " + parametro + " ORDER BY TITLES.TITLE";

parametro is a variable.

This is the message error: Error conexion: java.sql.SQLException: Unexpected token: = in statement [SELECT AUTHORS.AU_LNAME, AUTHORS.AU_FNAME, TITLES.TITLE, TITLES.PRICE, TITLES.TITLE_ID FROM AUTHORS, TITLEAUTHOR, TITLES WHERE TITLES.TITLE_ID == Submit ORDER BY TITLES.TITLE]

Reply With Quote
  #2  
Old June 4th, 2003, 09:20 AM
zapa zapa is offline
Mentat of IX
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Bucuresti / Toronto
Posts: 112 zapa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 sec
Reputation Power: 6
Send a message via ICQ to zapa
heh , this shold be interesting

to tell you the trouth , I myself have had some similar problems when joining tables and having to specify tablename.column instead of just column ...

to fix my problem I just gave unique names to all of my columns and didn't specify the tablename in the JDBC query , however that might not allwais be an option .

Reply With Quote
  #3  
Old June 4th, 2003, 09:25 AM
pabloj's Avatar
pabloj pabloj is offline
Modding: Oracle MsSQL Firebird
Dev Shed God 6th Plane (7500 - 7999 posts)
 
Join Date: Jun 2001
Location: Outside US
Posts: 7,917 pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level)pabloj User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 2 Months 3 Weeks 3 Days 15 h 52 m 3 sec
Reputation Power: 279
String query = "SELECT AUTHORS.AU_LNAME, AUTHORS.AU_FNAME, TITLES.TITLE, TITLES.PRICE, TITLES.TITLE_ID FROM AUTHORS, TITLEAUTHOR, TITLES" +
" WHERE TITLES.TITLE_ID = '" + parametro + "' ORDER BY TITLES.TITLE";

Reply With Quote
  #4  
Old June 4th, 2003, 09:33 AM
zapa zapa is offline
Mentat of IX
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Bucuresti / Toronto
Posts: 112 zapa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 sec
Reputation Power: 6
Send a message via ICQ to zapa
hmmm , I might be wrong here but i've done quite a few queries without using the ' ' when i'm comparing an integer . I did have such a problem when i was comparing a string but not integers ...

is title_id an integer or some sort of character type ?

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > SQL in a Servlet


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT