• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help Me

 
Chris Goh
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i'm using Mysql and i have downloaded the jdbc for it. I have set the classpath and eveything but i keep getting a error message:
org.apache.jasper.JasperException: Unable to compile class for JSPC:\Tomcat\jakarta-tomcat-3.2.3\work\localhost_8080\_0002flogin_0002flogin_0002ejsplogin_jsp_9.java:79: Ambiguous class: java.beans.Statement and java.sql.Statement
Statement statement = Conn.createStatement();
^
Here are my codes:
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Connection Conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/Login?user=Administrator&password=");
Statement statement = Conn.createStatement();
it there anything wrong? pls help...
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As you can see in the line:
Ambiguous class: java.beans.Statement and java.sql.Statement
you have 2 classes called Statement but in different packages to go around this change the line where you reference the Statement
Statement statement = Conn.createStatement();
to:
java.sql.Statement statement = Conn.createStatement();
this should stop this error.
regards.
 
Chris Goh
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you ver much!
but at the top of my page i have included:
<%@ page language="java" import="java.sql.*" %>
so why do i have to retype: java.sql.Statement statement = Conn.createStatement();
what is the reason?

 
Chris Goh
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks !!!
There's one question thought, i have included the :
<%@ page language="java" import="java.sql.* %><br /> at the top of my JSP page. So why do i have to retype for<br /> java.sql.Statement....
 
Marcos Maia
Ranch Hand
Posts: 977
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I miss something here what did you include at the top of your jsp page?
 
Chris Goh
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
page language="java" import="java.sql.*
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic