-
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, ...
}
-
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.
-
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?
-
Do you know about JDBC and SQL in general?
If not then this will be meaningless anyway.