• 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

General error can any body solve this problem

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just created simple jsp file which is show me the data from database but when i run that program it will show me the java.sql.SQLException: General error. I give the code in below


file name is showData.jsp
[code=java]
<%@ page contentType="text/html" pageEncoding="UTF-8"%>

<%@ page import="java.sql.*" %>
<%@ page import="java.util.*"%>

<html>
<head>
<title>Showing data</title>
</head>
<body>
<%

out.println("welcom to my web-site");

%>

<%
try
{
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn=null;
conn = DriverManager.getConnection("jdbc:odbc:employee1", "", "");
out.println ("Database Connected.");


}
catch(SQLException e)
{
out.println(e);
e.getStackTrace();
}
%>
</body>
</html>[/code]
 
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings hitendra and welcome to the ranch,
Can you please show us the stack trace of the complete excpetion ?

java.sql.SQLException: General error

This is very abstract and general. The root cause may be in the log files. Also kindly use code tags since it becomes quite difficult to read code in text format.
 
hitendra dongare
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for replying sir but i only get the only General error
 
Ranch Hand
Posts: 47
MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Hitendra

Can you try with this-put e.printStackTrace(); in catch block then see,maybe it will work.
 
hitendra dongare
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i put it that on my code but it will not work still i get the same error message
 
Saif Asif
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see. Well there doesn't seem to be any fault with your code. Can you verify a couple of things on your end like the name of the driver ( is it present on the classpath and the lib folder ), also verify that you are using the correct Database name , also make sure that it has read/write privilages because I see that you have left the user name and password field as empty on the getConnection() method.
 
Saif Asif
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

hitendra dongare wrote:i put it that on my code but it will not work still i get the same error message



Can you paste the entire stack trace ? Also verify the things I have asked of you in my previous post.
 
hitendra dongare
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes i verify all things this program is run on eclipse but when i try to run on using web-browser it will not work. is their any configuration on Apache tomcat
 
Saif Asif
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

hitendra dongare wrote:yes i verify all things this program is run on eclipse but when i try to run on using web-browser it will not work. is their any configuration on Apache tomcat



How are you running it on eclipse and not on web-browser ? It is a JSP page, the only way to test it is to deploy it on tomcat and access it on web-browser .
 
hitendra dongare
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
but why it show me

and how to resolve that
 
Saif Asif
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You haven't told me as yet that how are running the code from eclipse as you said its working fine on eclipse ?
 
Saif Asif
Ranch Hand
Posts: 440
Hibernate Eclipse IDE Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Bear I cant move the post and I was waiting since morning for some moderator to show up and move it to the appropiate forum .
 
reply
    Bookmark Topic Watch Topic
  • New Topic