Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

"Could Not Eexcute Query" on Glassfish Server

Posted on 2011-03-21
15
Medium Priority
?
374 Views
Last Modified: 2012-05-11
I have written a MySQL Query which runs perfectly in eclipse using a Hibernate session....But When a WAR File is created and deployed on Glassfish server i get "Could Not Eexcute Query"

ServerLog
0
Comment
Question by:CCBRONET
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 2
  • +1
15 Comments
 
LVL 47

Expert Comment

by:for_yan
ID: 35178992
It says
 java.sql.SQLException: Column 'cgl_desc' not found.
Are you using the same instance of the database ?
0
 
LVL 92

Expert Comment

by:objects
ID: 35178993
> Column 'cgl_desc' not found.

its not finding a column
check your hitting the same database
0
 

Author Comment

by:CCBRONET
ID: 35179016
the query runs fine in the development enviornment....as it runs perfectly in eclipse....but when a WAR file is deployed i get the above error....the column does exist in my db....I have attached the query...,Plz Advise...
@Override

public List getLNSTrialExecute(Date CurrentworkDt, char siType, int prodId) throws MyException 
{

Session session = HibernateUtil.getSession();

List<Object[]> lstAdvMaster = null;

try 
{		

	lstAdvMaster = session.createSQLQuery("SELECT s.sim_branch_code, s.sim_product_id, c.cgl_desc as DrProdDesc, s.sim_account_no, " +

		"s.sim_end_dt, s.sim_execution_day, s.sim_frequency, s.sim_branch_cd1, cb.ceb_branch_name, s.sim_product_id1, " +

		"cgl.cgl_desc as CrProdDesc, s.sim_account_no_cr, s.sim_amount, s.sim_srno1, s.sim_next_exec_dt, s.si_status, " +

		"s.sim_times_exec_mthly, s.sim_record_status FROM si_maintenance s INNER JOIN code_gl c ON (s.sim_product_id = c.cgl_code) " +

		"INNER JOIN code_gl cgl ON (s.sim_product_id1 = cgl.cgl_code) INNER JOIN code_ebank cb ON (s.sim_branch_cd1 = cb.ceb_micr) " +

		"WHERE s.sim_product_id1 = :prodId AND s.si_status IN ('C','I') AND s.sim_si_complete = :sicomplete AND s.sim_si_type = :siType AND " +

		"s.sim_next_exec_dt <= :CurrentworkDt AND s.sim_record_status = 2").setParameter("siType", siType)
		.setParameter("CurrentworkDt",CurrentworkDt).setParameter("sicomplete", 'N').setParameter("prodId", prodId).list();    

}
catch (Exception e) 

{

	e.printStackTrace();

	throw new MyException(e.getMessage());

}	

	return lstAdvMaster;

}

Open in new window

0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 47

Expert Comment

by:for_yan
ID: 35182368
Still it is rather strange that it would write that there is no field cgl_desc.
Do you have an option to execute this query manually at the SQL prompt, just to check?
That's what I usually do when I get errors from JDBC-Oracle part.
Even though it works  from Eclipse, maybe that could give you a clue; the whole thing seems really strange...
0
 

Author Comment

by:CCBRONET
ID: 35187055
fro_yan,
               Yes I have tried to run the query in EMS SQL Manager Query Editor the query runs perfectly....It seems pretty strange....
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35187062
Yes, don't know what to think, really strange...
0
 
LVL 47

Expert Comment

by:for_yan
ID: 35187101
Is that the first query which needs ti be executed in your code - is it the first time when you address database that it reports this error?
0
 

Author Comment

by:CCBRONET
ID: 35187164
No before this 2-3 hibernate queries get executed....then this one which is the first SQL Query....
0
 
LVL 47

Accepted Solution

by:
for_yan earned 2000 total points
ID: 35187178
Maybe you could try firs to execute for the sake of testing some pretty simple SQL query, so that
you could check if it executes; just I'm running out of ideas
0
 

Author Comment

by:CCBRONET
ID: 35187198
Will try that n get right back....for_yan
0
 
LVL 4

Expert Comment

by:msk_apk
ID: 35187515
connect to mysql directly and check whether that column exist. or run this query in the db client and check that query is getting executed with out any problem. it could help us to identify whether the problem is in the database or hibernate configuration.
0
 

Author Comment

by:CCBRONET
ID: 35187575
msk_apk: The query ran perfectly in MySQL prompt query gets executed....
0
 
LVL 4

Expert Comment

by:msk_apk
ID: 35187866
can you also post the query that is getting executed in mysql prompt?
0
 

Author Comment

by:CCBRONET
ID: 35398604
thanks got solved
0
 

Author Closing Comment

by:CCBRONET
ID: 35481281
....
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
In this article, we’ll look at how to deploy ProxySQL.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question