• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SQLException

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All
I am testing datasource usage in JBoss with mysql database. I've created the configuration file, and run the client, but I got the following exception:

Exception thrown java.sql.SQLException: Table not found in statement [select * from quest_choices]

Table quest_choices exists and contains data, but I don't know why I got this error. I am using JBoss 5 and mysql 5.1.7, any help will be highly apprecieated...

Thanks
 
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Are you using the same schema to connect in application ?
 
Jotnarta Jot
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, the same schema in mysql-ds.xml file and in the client...
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have not used mysql DB .. i understood its starts up in different sqlmode. check the link if this helps
 
Jotnarta Jot
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you buddy for yr time, but I think it's not a sql mode problem. I defined the datasource to be available for JBoss, as any other database. then, I lookued up the datasource to get the connection for my database and schema.

I finished the above, and after running a simple sql statement against the database, I got SQLException stating that the table doesn't exist , I don't know why???
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Buddy ,

Better post your configuration xml and code to help better. Can you try to query DUAL table atleast to make sure the datasource configuration are correct and the problem is related to "table name and schema".
 
Jotnarta Jot
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried another table, it gave me the same results. One noticed thing is that connection is established, but when you try to run an sql statement against a given table, it will give you an error message stating that table don't exist......
 
Jotnarta Jot
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is my mysql-ds.xml file:


and this is my jsp file which i used to try my datasource:


One thing, If I changed my datasouce name other than DefaultDS, I'll get a NamingException..

Any help pleeeeeeeease??
 
Author
Posts: 198
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you remember to delete the default hsqldb-ds.xml file from your deploy directory?
 
Jotnarta Jot
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes I did, Is there any other configuration files that I must changed???
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Will the ; at the end of the Select statement work?( i hv nt tried anything like that) Even then i believe it throws Table or view does not exists
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I thought Balu might have something there so I tried with and without the ';' at the end of the select - both worked.

But let me back up. I copied the code from your other code into one of my projects. Of course I changed the database and table name to match something I had. And everything worked. One caveat: I did not use server-side script in a JSP - instead I placed the code in a servlet and passed the resulting string to the JSP which accessed if via EL.

A few suggestions.

1) Do not call the datasource DefaultDS. Your other post that used MyDS is better.
2) Do not remove hsqldb-ds.xml - the DefaultDS is needed by several JBoss AS services. (You can replace it, but it takes some work. Ch15 of JBoss in Action provides the details)
3) Do what I did - put your code in a servlet, pass the string to the JSP and use EL. Not mandatory, but saner.

Here is a recap of everything you have to do, starting with a fresh install of JBoss AS 5.0.0.GA:

1) Copy the mysql JDBC JAR file to server/default/lib
2) Copy your mysql-ds.xml file to server/default/deploy
3) Copy your WAR file to server/default/deploy
4) Start the app server and access the JSP

Good luck.
 
Balu Sadhasivam
Ranch Hand
Posts: 874
Android VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Peter,

The character ';' will not work in ORACLE driver implementations, hence the thought , anyways thanks for confirming.
 
We cannot change unless we survive, but we will not survive unless we change. Evolving tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic