#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2001
    Location
    Lisbon
    Posts
    45
    Rep Power
    13

    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
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Posts
    11
    Rep Power
    0

    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

IMN logo majestic logo threadwatch logo seochat tools logo