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 7611613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:42:20+00:00 2026-05-31T01:42:20+00:00

I have a managed bean which makes SQL queries to Oracle database. This is

  • 0

I have a managed bean which makes SQL queries to Oracle database. This is just very simple example how I make SQL queries. This is the table structure:

GLOBALSETTINGS
---------------------------------
SessionTTL          VARCHAR2(40 BYTE)
MAXACTIVEUSERS  NUMBER
ACTIVEUSERS         VARCHAR2(20 BYTE)

I use this table just to store application settings. In the example listed below I can fetch just one string with one SQL statement. I want with SQL query to fetch the content of the three rows – SessionTTL, MAXACTIVEUSERS, ACTIVEUSERS. Is it possible?

   public String CheckUserDB(String userToCheck) throws SQLException {
        String storedPassword = null;        
        String SQL_Statement = null;

        if (ds == null) throw new SQLException();      
   Connection conn = ds.getConnection();
        if (conn == null) throw new SQLException();      

   try {
        conn.setAutoCommit(false);
        boolean committed = false;
            try {
                   SQL_Statement = "SELECT Passwd from USERS WHERE Username = ?";

                   PreparedStatement passwordQuery = conn.prepareStatement(SQL_Statement);
                   passwordQuery.setString(1, userToCheck);

                   ResultSet result = passwordQuery.executeQuery();

                   if(result.next()){
                        storedPassword = result.getString("Passwd");
                   }

                   conn.commit();
                   committed = true;
             } finally {
                   if (!committed) conn.rollback();
                   }
        }
            finally {               
            conn.close();

            }  

   return storedPassword;       
   }                         

P.S I want the content of the rows.

  • 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-05-31T01:42:21+00:00Added an answer on May 31, 2026 at 1:42 am

    I’m hoping I understand what you are asking for, but I fear I don’t as it seems too simple, but anyway…

    I think you want the contents of 3 columns, not rows. And yes you can, you just specify the columns you want returned in your SQL statement:

    SELECT SessionTTL, MAXACTIVEUSERS, ACTIVEUSERS FROM GLOBALSETTINGS WHERE (condition)...
    

    you can also use * as a shortcut for all columns iof you don’t want to explicitly specify them:

    SELECT * FROM GLOBALSETTINGS WHERE (condition)...
    

    Some background reading on SQL syntax might be useful

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this managed bean which makes SQL queries to Oracle database and returns
I have this managed bean which takes two values from database's table import java.io.Serializable;
I have a very simple managed bean LOB which is used for reading existing
I have a managed bean which gets list of settings and values from database
I have this java code which is a part of a managed bean which
I'm using JSF 2.0. I have a managed bean which I can access through
I have one method in my managed bean which returns javascript as a string.
i have an managed bean(session scope) like this: class Home {// as homeBean public
I have a situation with a legacy system which uses Java EE Bean Managed
I have an application scoped managed bean which main purpose is to serve the

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.