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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:12:56+00:00 2026-06-04T11:12:56+00:00

Connection conn = null; Statement stmt=null; ResultSet rset=null; String jdbc_url=jdbc:oracle:thin:hr/hr@bassam-desktop:1521:XE; String query=; try {

  • 0
Connection conn = null;
Statement stmt=null;
ResultSet rset=null;
String jdbc_url="jdbc:oracle:thin:hr/hr@bassam-desktop:1521:XE";
String query="";
try
{
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    conn=DriverManager.getConnection(jdbc_url);
    stmt=(Statement) conn.createStatement();
    query="select first_name" +"from employees"+"where employeed_id=100";
    rset=stmt.executeQuery(query);
    System.out.println(rset.getString(1));


}
catch(SQLException | NumberFormatException e)
        {
            System.out.println("result error");
        }
finally{
    try{
        rset.close();
        stmt.close();
        conn.close();

    }
    catch(Exception e)
    {
        System.out.println("Error in closing");
    }
}

I’m getting both errors in the results window, what is the problem? hr password is correct, my host name is correct, isn’t it the one you get from “Computer Name” after you right click on “My Computer” in windows xp ?

Edit: After using e.getMessage(), i got this..

result error, ResultSet.next was not called

  • 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-04T11:12:58+00:00Added an answer on June 4, 2026 at 11:12 am

    The error message of the exception, that you have put in the comments, tells you what’s wrong:

    result error, ResultSet.next was not called

    You forgot to call ResultSet.next() before accessing the first row of the result set:

    if (rset.next()) {
        System.out.println(rset.getString(1));
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our standard code section for using JDBC is... Connection conn = getConnection(...); Statement stmt
response.setContentType(text/html); PrintWriter out = response.getWriter(); Connection conn = null; String url = jdbc:mysql://localhost:3306/; String
I use the following codes to connect to Oracle's database: Connection conn = null;
try { // CompareRecord record = new CompareRecord(); Connection conn = new CompareRecord().getConection(eliteddaprd,eliteddaprd,192.168.14.104,1521); ResultSet
This code runs OK in a pure Java application: Connection conn = null; Statement
Which of the following is correct (or does it matter). Connection conn = null;
Generally we esablish a connecton in ASP as follows set conn=Server.CreateObject(ADODB.Connection) conn.Provider=Microsoft.Jet.OLEDB.4.0 conn.Open(Server.Mappath(/db/northwind.mdb)) set
In connection string to SQL Server there is max pool size option. My question
I have an Oracle Connection to a ORACLE 10.2 database and want to listen
I'm working on OSGI bundle which uses JDBC connection in order to update rows

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.