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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old March 4th, 2002, 11:39 AM
IrinaIonela IrinaIonela is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2001
Location: Lisbon
Posts: 45 IrinaIonela User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Arrow compile error-don't know how to extend class

I'm not able to instantiate class ResultSet from PHP so i intended
to extend your classes in order to call its methods from PHP


Java compile error-don't know how to extend class


I'm trying to extend a class that implements an interface:
: public class relationset extends org.gjt.mm.mysql.Driver

class: org.gjt.mm.mysql.Driver
interface: java.sql.Driver

with the following Java code:
PHP Code:
 import java.sql.*;
 
import java.io.*;

public class 
relationset extends org.gjt.mm.mysql.Driver
{
    public static 
ResultSet execQuery() throws SQLException
    
{
        try
        {
            
Connection databaseConnection DriverManager.getConnection("jdbc:mysql://172.16.4.39:3306/ssntvjp""root""");

            
String sqlString "SELECT * FROM Descriptor D WHERE D.SubDescriptor IS NULL";

            
Statement stmt databaseConnection.createStatement();

            return 
stmt.executeQuery(sqlString);
        }
        catch(
SQLException e)
        {
            throw(
e);
        }
    }



....but the following error occurs:

.\relationset.java:7: unreported exception java.sql.SQLException; must be caught or declared to be thrown

Can anybody tell-me what is wrong with this approah?

Where's
wally ?

Irina/Lisbon/Portugal

Reply With Quote
  #2  
Old March 6th, 2002, 01:35 PM
kingjr3 kingjr3 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2001
Posts: 11 kingjr3 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to kingjr3
not sure?

I believe since the org.gjt.mm.mysql.Driver class throws a SQLException that your new class, relationset , must also throw an exception.

I believe you could do this by adding a constructor method that throws an error, or try by adding appending "throws SQLException" to
public class relationset extends org.gjt.mm.mysql.Driver

good luck

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > compile error-don't know how to extend class


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 6 hosted by Hostway