Using the JDBC services to connect to a Google Cloud SQL and
following the example of the overview everything works as expected.
When I try to do some other SQL statement like select database();
I get the error : Resultset does not have a column 1
This is the code I am using.
var sqlStatement = "select database();";
var pstmt = conn.prepareStatement(sqlStatement);
var rs = pstmt.executeQuery(sqlStatement);
app.add(app.createLabel(rs.getString(1)));
I also tried with getObject() but it does get any better .
So any Idea, tutorials or examples how to deal with sqlStatements
different than the tipical select like use database or
select database()?
You are missing the statement to start the iterator – this is the .next() call on the record set. Here is an function that works for me. I am just logging the DB name here using Logger, but same should work for UiApp as well.