Results 1 to 4 of 4
  1. #1
    emilotte is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default GenerateResultSet

    What does the following code mean?

    public void generateResultSet()
    {
    try
    {

    String query="Insert into Gebruikers (email, paswoord, voornaam, familienaam) Values ('email@hotmail.com','paswoord','Voornaam','Famili enaam')";

    performQuery(query);

    databaseStmt = databaseConnection.createStatement();
    System.out.println("In generate resultset voor query");
    databaseRS = databaseStmt.executeQuery("Select * from Gebruikers;");
    System.out.println("In generate resultset na query");
    printResultSet(databaseRS);
    } // END TRY
    catch(SQLException error)
    {
    System.out.println( "Error connecting to database: \n" + error.toString());

    } // END CATCH
    }




    And what does this mean???


    class PrintColumnTypes {

    public static void printColTypes(ResultSetMetaData rsmd)
    throws SQLException {
    int columns = rsmd.getColumnCount();
    for (int i = 1; i <= columns; i++) {
    int jdbcType = rsmd.getColumnType(i);
    String name = rsmd.getColumnTypeName(i);
    System.out.print("Column " + i + " is JDBC type " + jdbcType);
    System.out.println(", which the DBMS calls " + name);
    }
    } // UITSCHRIJVEN MET WELKE SOORT WE BEZIG ZIJN, STRING, INT, ...
    }

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default

    What do you think it means?
    The first one is fairly self-explanatory (if a little pointless).
    As is the second one come to that.

  3. #3
    emilotte is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default

    Can you just explain what the first one means, we think that the second one prints the types of the data.

    Can you confirm this?

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,091
    Rep Power
    20

    Default

    Do you know about JDBC and SQL in general?
    If not then this will be meaningless anyway.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •