•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 391,548 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,519 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 5428 | Replies: 1
![]() |
•
•
Join Date: Mar 2006
Posts: 20
Reputation:
Rep Power: 3
Solved Threads: 0
Hi,
I have an error, during accessing a datbase using jsp:useBean from jsp.Urgent i need this one
my source code ispackage SQLBean;
DbBean.java
import java.sql.*;
import java.io.*;
public class DbBean implements java.io.Serializable{
private String dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
private Connection dbCon;
public DbBean(){
super();
}
public boolean connect() throws ClassNotFoundException,SQLException{
Class.forName(dbDriver);
dbCon = DriverManager.getConnection("jdbc dbc:mybean","","");
return true;
}
public void close() throws SQLException{
dbCon.close();
}
public ResultSet execSQL(String sql) throws SQLException{
Statement s = dbCon.createStatement();
ResultSet r = s.executeQuery(sql);
return (r == null) ? null : r;
}
public int updateSQL(String sql) throws SQLException{
Statement s = dbCon.createStatement();
int r = s.executeUpdate(sql);
return (r == 0) ? 0 : r;
}
}
database.jsp
<HTML>
<HEAD><TITLE>DataBase Search</TITLE></HEAD>
<BODY>
<%@ page language="Java" import="java.sql.*" %>
<jsp:useBean id="db" scope="application" class="SQLBean.DbBean" />
<jsp:setProperty name="db" property="*" />
<center>
<h2> Results from </h2>
<hr>
<br><br>
<table>
<%
db.connect();
ResultSet rs = db.execSQL("select * from employ");
int i = db.updateSQL("UPDATE employ set fname = 'hello world' where empno='000010'");
out.println(i);
%>
<%
while(rs.next()) {
%>
<%= rs.getString("empno") %>
<BR>
<%
}
%>
<BR>
<%
db.close();
%>
Done
</table>
</body>
</HTML>
The error like this
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
error: Invalid class file format in C:\Program Files\Apache Tomcat 4.0\webapps\muthu\WEB-INF\classes\SQLBean\DbBean.class. The major.minor version '49.0' is too recent for this tool to understand.
An error occurred at line: 7 in the jsp file: /database.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\localhost\muthu\database$jsp.java:65: Class SQLBean.DbBean not found.
SQLBean.DbBean db = null;
^
An error occurred at line: 7 in the jsp file: /database.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\localhost\muthu\database$jsp.java:68: Class SQLBean.DbBean not found.
db= (SQLBean.DbBean)
^
An error occurred at line: 7 in the jsp file: /database.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\localhost\muthu\database$jsp.java:73: Class SQLBean.DbBean not found.
db = (SQLBean.DbBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "SQLBean.DbBean");
^
4 errors, 1 warning
Anybody help me?
Thanx in advance
I have an error, during accessing a datbase using jsp:useBean from jsp.Urgent i need this one
my source code ispackage SQLBean;
DbBean.java
import java.sql.*;
import java.io.*;
public class DbBean implements java.io.Serializable{
private String dbDriver = "sun.jdbc.odbc.JdbcOdbcDriver";
private Connection dbCon;
public DbBean(){
super();
}
public boolean connect() throws ClassNotFoundException,SQLException{
Class.forName(dbDriver);
dbCon = DriverManager.getConnection("jdbc dbc:mybean","","");
return true;
}
public void close() throws SQLException{
dbCon.close();
}
public ResultSet execSQL(String sql) throws SQLException{
Statement s = dbCon.createStatement();
ResultSet r = s.executeQuery(sql);
return (r == null) ? null : r;
}
public int updateSQL(String sql) throws SQLException{
Statement s = dbCon.createStatement();
int r = s.executeUpdate(sql);
return (r == 0) ? 0 : r;
}
}
database.jsp
<HTML>
<HEAD><TITLE>DataBase Search</TITLE></HEAD>
<BODY>
<%@ page language="Java" import="java.sql.*" %>
<jsp:useBean id="db" scope="application" class="SQLBean.DbBean" />
<jsp:setProperty name="db" property="*" />
<center>
<h2> Results from </h2>
<hr>
<br><br>
<table>
<%
db.connect();
ResultSet rs = db.execSQL("select * from employ");
int i = db.updateSQL("UPDATE employ set fname = 'hello world' where empno='000010'");
out.println(i);
%>
<%
while(rs.next()) {
%>
<%= rs.getString("empno") %>
<BR>
<%
}
%>
<BR>
<%
db.close();
%>
Done
</table>
</body>
</HTML>
The error like this
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
error: Invalid class file format in C:\Program Files\Apache Tomcat 4.0\webapps\muthu\WEB-INF\classes\SQLBean\DbBean.class. The major.minor version '49.0' is too recent for this tool to understand.
An error occurred at line: 7 in the jsp file: /database.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\localhost\muthu\database$jsp.java:65: Class SQLBean.DbBean not found.
SQLBean.DbBean db = null;
^
An error occurred at line: 7 in the jsp file: /database.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\localhost\muthu\database$jsp.java:68: Class SQLBean.DbBean not found.
db= (SQLBean.DbBean)
^
An error occurred at line: 7 in the jsp file: /database.jsp
Generated servlet error:
C:\Program Files\Apache Tomcat 4.0\work\localhost\muthu\database$jsp.java:73: Class SQLBean.DbBean not found.
db = (SQLBean.DbBean) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "SQLBean.DbBean");
^
4 errors, 1 warning
Anybody help me?
Thanx in advance
•
•
Join Date: Apr 2006
Location: Mumbai, India
Posts: 351
Reputation:
Rep Power: 0
Solved Threads: 4
•
•
•
•
Originally Posted by muthumari
org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
error: Invalid class file format in C:\Program Files\Apache Tomcat 4.0\webapps\muthu\WEB-INF\classes\SQLBean\DbBean.class. The major.minor version '49.0' is too recent for this tool to understand.
The error message is clear enough. You are compiling the class(es) with a higher version of JDK than what Tomcat 4.0 is supposed to use. From the major.minor version = 49.0, I guess you are using JDK 1.4. If you want to generate classes compatible with the older versions [JDK 1.3 in your case], you will have to make use of the -source and -target options while compiling your class. The source option specified as "1.3" will indicate that the source files are compatible to JDK 1.3 and the target option set to "1.3" indicates that the generated classes will be compatible from JDK 1.3 onwards.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
•
•
•
•
adsl adsl1 adsl2 adsl2+ algos avatar backup breach cable connection daniweb data protection database design download fortitude government hacker hope ibm internet kb kbps mbit medicine network news normalization per second security server sql struggle survey testing throughput trial-and-error upload victory 240000
- database connection(select ,insert query) within javascript function (JSP)
- Help me in username and password validation through accessing the database (ASP.NET)
- Login Page Database connection to MSAccess (VB.NET)
- Problem with database connection (JSP)
- Sometimes an error come out "Could not connect to database".Why?? (Oracle)
- WML and connection to Acess and JSP/tomcat (Computer Science and Software Design)
Other Threads in the JSP Forum
- Previous Thread: URGENT: JSP - StackOverFlow Error
- Next Thread: Error is [Microsoft][ODBC SQL Server Driver]Connection is busy


Linear Mode