Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9117447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:53:53+00:00 2026-06-17T04:53:53+00:00

Using the JDBC services to connect to a Google Cloud SQL and following the

  • 0

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()?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:53:54+00:00Added an answer on June 17, 2026 at 4:53 am

    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.

    function simpleRead() {
      var conn = Jdbc.getCloudSqlConnection("jdbc:google:rdbms://arunnagarajan:...");
      var stmt = conn.createStatement();
      var rs = stmt.executeQuery("select database()");
      rs.next(); //if you expect multiple rows, then do this in while(rs.next()) loop
      Logger.log(rs.getString(1));
      rs.close();
      stmt.close();
      conn.close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to connect to MySQL using JDBC connection in a Servlet .I'm using
We are currently using Spring JDBC with connection pool implementation from DBCP to connect
I am using Postgres 9.1.5. The JDBC works fine on the very first instance
I try to move some services from my Tomcat Server to Jetty, just to
I am trying to connect to an Oracle Database using java and JDBC code.
My problem is in Exception Block I have shown,I can connect using GUI(PL/SQL developer)
I am trying to connect to derby database while using Tomcat . I try
I'm trying to connect to databse using jade java and jdbc public class IntermediaryAgent
I'm using JPA (Hibernate as provider), Glassfish and MySQL. Everything works great in development,
I'm attempting to connect to a MySQL database using JDBC. The MySQL database is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.