I tried to do this:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.h2.util.Profiler;
public class Profile {
private static Profiler prof;
/**
* @param args
* @throws ClassNotFoundException
* @throws SQLException
*/
public static void main(String[] args) throws ClassNotFoundException,
SQLException {
Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection("jdbc:h2:tcp://
localhost/~/test", "sa", "");
java.sql.Statement stat = conn.createStatement();
prof = new Profiler();
ResultSet rs = stat.executeQuery("SELECT 'Hello World'");
while (rs.next())
{
System.out.println(rs.getString(1));
}
stat.executeUpdate("insert into test_table (id,resolver) values
( 3,
'Quest') ");
ResultSet rs2 = stat.getResultSet();
while(rs2.next())
{
System.out.println(rs.getInt("id"));
System.out.println(rs.getString("resolver"));
}
prof.stopCollecting();
System.out.println(prof.getTop(3));
conn.close();
}
}
and got an error:
Hello World
Exception in thread "main" java.lang.NullPointerException
at Profile.main(Profile.java:25)
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.