• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem connecting to my database.

 
Greg Funston
Ranch Hand
Posts: 81
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I have been working away for a while now on getting familiar with Java EE and I am trying to connect to a database. I believe I have been successful but I now have what seems to be a syntax problem with SQL. My error being produced by my testpage is

" javax.servlet.ServletException:
USE affablebean;
SELECT (*) FROM 'product';
: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT (*) FROM 'product'' at line 3"

As you can see I am working through the affablebean tutorial. I believe I have a connection to the database but I am getting SQL syntax errors now. Can someone please point me in the right direction for the solution to my problem.

Thanks,

Greg Funston
 
Greg Funston
Ranch Hand
Posts: 81
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, I found the solution to my problem. I had a statement which stated which database to use "USE affablebean" it was in the same place as the next statement
"SELECT * FROM tablename". I placed the first statement in a separate tag <sql:update> and the page now works correctly.



Cheers,

Greg Funston
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic