wood burning stoves*
The moose likes JDBC and the fly likes General Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "General Error" Watch "General Error" New topic
Author

General Error

K Sathya Narayanan
Greenhorn

Joined: Feb 15, 2007
Posts: 28
hi
i get java.sql.SQLException: General error

when i try to retrive the data(resultset ) in a custom tag class ie class which extends TagSupport. when the st.excuteQuery() is executed the above exception occurs. i am using Prepared Statement.The Query is correct ,
the drivername , dsn name , user id & password are also correct .
i get the record and populate them in a text box

I am developed a custom tag to insert a value into database but it works fine
i hacve also checked the Id ,Password in a custom tag and it wotks
fine

the below coding gets the exception

Connection con;
PreparedStatement ps;
ResultSet rs;

String query="select RoleId,EmpName,Email,Address,PhoneNo,CellNo from APS_EmployeeDetails where EmpId=? ";

try
{
Class.forName(DbConnect.getDriverName());
System.out.println(query);
con=DriverManager.getConnection(DbConnect.getDsnName(),DbConnect.getUid(),DbConnect.getPwd());

ps=con.prepareStatement(query);
ps.setString(1,empId);
//this code rasies the general error
rs=ps.executeQuery();

....
Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
Hi Sathya,
First check if you connection is alive. Check the log if the server is running. Some times the exception may be something else but you will get this general error.

Second try to execute the SQL query and see if you are getting any results. If yes then hard code the employee id and try running the program.

Lastly instead of catching SQLException catch just Exception and see if you see some other error.

Hope this helps.


Regards,
Sivaraman.L
Sivaraman Lakshmanan
Ranch Hand

Joined: Aug 02, 2003
Posts: 231
Hi Sathya,
First check if you connection is alive. Check the log if the server is running. Some times the exception may be something else but you will get this general error.

Second try to execute the SQL query and see if you are getting any results. If yes then hard code the employee id and try running the program.

Lastly instead of catching SQLException catch just Exception and see if you see some other error.

Hope this helps.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: General Error