Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

can't run query from java war

 
moshi cochem
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I developed a jar file which turn to the h2 db and reads data.
I included this jar inside a web application that I developed using
eclipse.
I have a jsp file that reads data from the db using that jar. It works
fine in the eclipsa.
When I exectute war file out of that web app, and put it into the
webapps in tomcat server,
and run the application, I get an exception says that the db table I
try to read from is not exsisted:
"Table SYSTEMPARAMETERS not found".
This table is exsisted, and the fact that I can read from it using
that application in eclipse environment proofs it.

any idea?
thanks
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Moshi, I too faced the problem in the beginning, the problem is you have to mention the database name in the query,

select * from my_table; this will work well from eclipse.

But when you deploy you must write the query like this

select * from my_database.my_table; this will work, once try this.

Have a nice day.
 
moshi cochem
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Anusha, thanks for your reply.
My DB name is "test" , so I added it like this: select sysname, systemvalue from test.systemparameters
But unfortunately I get the error: "Schema TEST not found".
I realy don't know what to do...
If you have any other idea I'll be more then happy to here.
Thanks , Moshi.
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
moshi cochem wrote:Hi Anusha, thanks for your reply.
My DB name is "test" , so I added it like this: select sysname, systemvalue from test.systemparameters
But unfortunately I get the error: "Schema TEST not found".
I realy don't know what to do...
If you have any other idea I'll be more then happy to here.
Thanks , Moshi.


systemparameters table belongs to another schema, I think you are using oracle, am I correct. systemparameters belongs to the database provided schema, try to use it from that, not from your test database, if you want to do so, test database must contain that table created in it.

Have a nice day.
 
moshi cochem
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
systemparameters is the name that I gave to my table. it is like any other table...
 
moshi cochem
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And more than this:
when the db is opened, i can't use it from any other program - i get "db is already opened", and it's fine.
the problem is when the db is opened and i run my web app, i get exception of " table not exsist" and nothing about "db is already in use".
this issue, and the fact that he doesn't find my tables / db, makes me fill like he turn to another db from the web app.
But what (if so) is this additional db ?
thanks.
 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Did you check the datasource used by the Tomcat server is using test schema?
Thanks
Sudha
 
moshi cochem
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you mean that if it weren't test , but another name of db, there is a chance that the tomcat would run it fine ?
 
sudha swami
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
In JDBC, if you retrieving the connection from the datasource then make sure the datasource has the schema name as test.
Or If you are not using datasource, then while retrieving the connection(DriverManager.getConnection(.....)), check whether you are using the right schema name i.e. test.
Thanks
Sudha
 
chaitanya karthikk
Ranch Hand
Posts: 806
Java MySQL Database Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
moshi cochem wrote:you mean that if it weren't test , but another name of db, there is a chance that the tomcat would run it fine ?


Yes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic