Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old May 27th, 2002, 12:34 AM
deepspring's Avatar
deepspring deepspring is offline
Is a Psycho
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: In your computer
Posts: 231 deepspring User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via AIM to deepspring Send a message via Yahoo to deepspring
JSP and mm.MySQL

Hi,

Does anyone know why I would be getting this error:

Code:
Internal Servlet Error:

org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
C:\Dev\tomcat\work\localhost_8080\_0002findex_0002ejspindex_jsp_4.java:71: Ambiguous class: java.beans.Statement and java.sql.Statement
                	Statement stmt = myConn.createStatement();
                	^
1 error, 1 warning


When trying the following code:

Code:
<html>
<head></head>
<%@ page language="java" import="java.sql.*" %>
<body>

<%
	Class.forName("org.gjt.mm.mysql.Driver").newInstance();
	
	Connection myConn = DriverManager.getConnection("jdbc:mysql://localhost/mysite?user=root&password=");
	//myConn = DriverManager.getConnection("jdbc:mysql://localhost/mysite", "root", "");
	
	Statement stmt = myConn.createStatement();
	
	String strQuery = "select * from page_content where page_id=1";
	
	ResultSet rsResults = stmt.executeQuery(strQuery);
	
	if (rsResults != null) {
		while (rsResults.next()) {
			String strHeader = rsResults.getString("header");
			String strContent = rsResults.getString("content");
%>

	<h2><%= strHeader %></h2>
	<p><%= strContent %></p>

<%
		}
	}
%>
</body>
</html>
__________________
deepspring

- "Netscape 4 users are like lemmings... You can't help but laugh when one falls off a cliff"

Reply With Quote
  #2  
Old May 31st, 2002, 01:59 PM
Nemi Nemi is offline
Clueless llama
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Feb 2001
Location: Lincoln, NE. USA
Posts: 2,353 Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Days 12 h 35 m 19 sec
Reputation Power: 111
It looks as if you are importing 2 packages that both have a Statement class and it does not know which one to use. Try using the fully qualified name of the class like:
Code:
java.sql.Statement stmt = myConn.createStatement();

Reply With Quote
  #3  
Old June 1st, 2002, 02:32 AM
deepspring's Avatar
deepspring deepspring is offline
Is a Psycho
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: In your computer
Posts: 231 deepspring User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via AIM to deepspring Send a message via Yahoo to deepspring
Cool thanx.. will try.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > JSP and mm.MySQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway