DriverManager cannot be resolved

plz help me with this one

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 83 in the jsp file: /form.jsp

DriverManager cannot be resolved

80: </head>

81:

82: <body>

83: <% DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

84: Connection conn=DriverManager.getConnection ("jdbc:oracle:thin:@127.0.0.1:1522:XE","system","786313");

[465 byte] By [anya_aaa] at [2007-11-27 3:53:44]
# 1
Have you imported the DriverManager somewhere in your code, or the entire java.sql.*?<%@ page import="java.sql.DriverManager" %> // or<%@ page import="java.sql.*" %>
kaderuda at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

no i hadn;t thx

but now i m getting this

exception

org.apache.jasper.JasperException: Unable to load class for JSP

org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:154)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:320)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

anya_aaa at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3
Then the class isn't in your application's classpath. Find the jar file containing the driver and put it in the application's WEB-INF/lib directory.
DrClapa at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4

thx a lot

now i don't understand this

An error occurred at line: 95 in the jsp file: /form.jsp

Type mismatch: cannot convert from int to String

92:

93: Statement stmt=conn.createStatement();

94:

95: String queryinsert = stmt.executeUpdate("INSERT INTO customer (cust_id,cust_first_name,cust_last_name,cust_address, cust_country,cust_email)VALUES(custId,firstname,lasttname ,address ,country ,email)");

96:

97:

98: String update = stmt.executeUpdate("UPDATE customer SET (cust_first_name = first_name ,cust_last_name = last_name ,cust_address =address ,cust_country = country,cust_email = email )WHERE (cust_first_name = first_name AND cust_last_name = last_name)") ;

anya_aaa at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 5
It's because stmt.executeUpdate() returns an int, not a String.
kaderuda at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 6
so instead of this what should i use?
anya_aaa at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 7
Let's rephrase the question: what did you expect that it should return then?
BalusCa at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 8
i want to get a stringi did this,hope this worksString queryinsert = stmt.executeQuery("INSERT INTO customer (cust_id,cust_first_name,cust_last_name,cust_address, cust_country,cust_email)VALUES(custId,firstname,lastname ,address ,country ,email)");
anya_aaa at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 9
Yes, but i mean: what value did you expect in this string?
BalusCa at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 10

actually i am extracting the information from the textfields in a jsp and storing them in the oracle database.

i got this error now

An error occurred at line: 95 in the jsp file: /form.jsp

Type mismatch: cannot convert from ResultSet to String

92:

93: Statement stmt=conn.createStatement();

94:

95: String queryinsert = stmt.executeQuery("INSERT INTO customer (cust_id,cust_first_name,cust_last_name,cust_address, cust_country,cust_email)VALUES(custId,firstname,lastname ,address ,country ,email)");

anya_aaa at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 11
That was not my question.You're executing an query and expecting a String outcome. What value should this outcome contain did you think? What would you want to do with this value?
BalusCa at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 12

actually i don't want anything

i just want the values to be stored in the database from the jsp page.

so i did this now

stmt.executeQuery("UPDATE customer SET (cust_first_name = first_name ,cust_last_name...........................

and i got this error

org.apache.jasper.JasperException: Unable to compile class for JSP:

Stacktrace:

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)

org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)

org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

this error is alien to me

anya_aaa at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 13

I recommend you to read at least the java.sql API and some JDBC tutorials to get some more understanding about the JDBC API.

Here are some links:

http://www.google.com/search?q=java+sql+api+site:sun.com

http://www.google.com/search?q=jdbc+tutorial+site:sun.com

In the API documentation you can read which parameters the methods expects and which results exactly they returns.

In the JDBC tutorual you can learn how to use them the right way.

BalusCa at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 14

ok at the moment i don't think there is problem with sql,my jsp is not getting connected to oracle.

i did this now

<body>

<% DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());

Connection conn=DriverManager.getConnection ("jdbc:oracle:thin:@127.0.0.1:1522:XE","system","786313");

String first_name = request.getParameter("firstName");

String last_name = request.getParameter("lastName");

String address = request.getParameter("address");

String country = request.getParameter("country");

String email = request.getParameter("email");

Statement stmt=conn.createStatement();

//String queryinsert =

//stmt.executeQuery("INSERT INTO customer (cust_id,cust_first_name,cust_last_name,cust_address, cust_country,cust_email)VALUES(custId,firstname,lastname ,address ,country ,email)");

//String update =

//stmt.executeQuery("UPDATE customer SET (cust_first_name = first_name ,cust_last_name = last_name ,cust_address =address ,cust_country = country,cust_email = email )WHERE (cust_first_name = first_name AND cust_last_name = last_name)") ;

stmt.close();

conn.close(); %>

i m getting this error

org.apache.jasper.JasperException: Unable to compile class for JSP:

Stacktrace:

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)

org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)

org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:415)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:308)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:286)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:273)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:566)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:308)

org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)

org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)

javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

anya_aaa at 2007-7-12 8:57:48 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 15
i have put my ojdbc.jar file in the right lib of apache and set classpath also , i m using oracle 10g.my connection is not getting established.plz help
anya_aaa at 2007-7-21 20:58:18 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...