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

  • Home
  • SEARCH
  • 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 810817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:56:44+00:00 2026-05-15T00:56:44+00:00

I’m just a java beginner. Do you have any tips there on how to

  • 0

I’m just a java beginner. Do you have any tips there on how to determine errors. I’m trying to connect to mysql derby database.
I don’t know how to determine the error, there is no red line, but there is a message box that shows up when I try to run the program.
All I want to do is to display the first record in the database.
All I get is this in the output:

E:\Users\users.netbeans\6.8\var\cache\executor-snippets\run.xml:45:

package Employees;

import java.sql.Statement;

import javax.swing.JOptionPane;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.ResultSet;
/**
 *
 * @author Nrew
 */
public class Students extends javax.swing.JFrame {

    Connection con;
   Statement stmt;
   ResultSet rs;


    /** Creates new form Students */
    public Students() {
        initComponents();

DoConnect();

    }

    public void DoConnect(){
          try {
            String host= "jdbc:derby://localhost:1527/YURA";
String uname = "bart";
String pword = "12345";
con = DriverManager.getConnection(host, uname, pword);

 stmt = con.createStatement( );
String SQL = "SELECT * FROM APP.XROSS";
 rs = stmt.executeQuery(SQL);
rs.next();

rs.next( );
int ids = rs.getInt("IDNUM");
String idz = Integer.toString(ids);
String fname = rs.getString("FNAME");
String lname = rs.getString("LNAME");
String course = rs.getString("COURSE");
String skul = rs.getString("SCHOOL");
String gen = rs.getString("GENDER");

TextIDNUM.setText(idz);
TextFNAME.setText(fname);
TextLNAME.setText(lname);
textCOURSE.setText(course);
textSCHOOL.setText(skul);
textGENDER.setText(gen);







        }
        catch (SQLException err) {
          JOptionPane.showMessageDialog(Students.this, err.getMessage());



    }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {

        TextIDNUM = new javax.swing.JTextField();
        TextFNAME = new javax.swing.JTextField();
        TextLNAME = new javax.swing.JTextField();
        textCOURSE = new javax.swing.JTextField();
        textSCHOOL = new javax.swing.JTextField();
        textGENDER = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(116, 116, 116)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(textGENDER, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(textSCHOOL, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(textCOURSE, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(TextLNAME, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(TextFNAME, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(TextIDNUM, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 151, Short.MAX_VALUE))
                .addContainerGap(243, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(37, 37, 37)
                .addComponent(TextIDNUM, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(TextFNAME, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(TextLNAME, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(textCOURSE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(textSCHOOL, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(textGENDER, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(67, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new Students().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify
    private javax.swing.JTextField TextFNAME;
    private javax.swing.JTextField TextIDNUM;
    private javax.swing.JTextField TextLNAME;
    private javax.swing.JTextField textCOURSE;
    private javax.swing.JTextField textGENDER;
    private javax.swing.JTextField textSCHOOL;
    // End of variables declaration

}
  • 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-15T00:56:45+00:00Added an answer on May 15, 2026 at 12:56 am

    Print the stackTrace like this:

    catch (SQLException err) {
        err.printStackTrace();  // <-- add this
    
        JOptionPane.showMessageDialog(Students.this, err.getMessage());
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 415k
  • Answers 415k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer sure there is visualHG which works for 2005 to 2013… May 15, 2026 at 9:06 am
  • Editorial Team
    Editorial Team added an answer The following should work better: string DDateTime::date2OracleDate(DATE Date) { string… May 15, 2026 at 9:06 am
  • Editorial Team
    Editorial Team added an answer For something quick and simple, that's perfectly fine. You could… May 15, 2026 at 9:06 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.