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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:51:31+00:00 2026-05-16T10:51:31+00:00

I am using JDBC to query a MySQL database for specific records from two

  • 0

I am using JDBC to query a MySQL database for specific records from two tables.

My MySQL query sample is this:

SELECT
r.name
  , r.network
  , r.namestring
  , i.name
  , r.rid
  , i.id
  , d.dtime
  , d.ifInOctets
FROM router AS r
INNER JOIN interface AS i
ON r.rid = i.rid
INNER JOIN 1278993600_1_60 AS d
ON i.id = d.id
AND dtime BETWEEN 1279027200 AND 1279029000
WHERE r.network = "ITPN"
AND i.status = "active"
WHERE i.id BETWEEN 1418 AND 1518

Now is it possible for me to add all the specific records which I need:

  r.name
, r.network
, r.namestring
, i.name
, r.rid
, i.id
, d.dtime
, d.ifInOctets

to an array specifically and print it out to an excel sheet?

I tried creating different classes for the 3 tables: r, i, d. Then as I queried the database I created objects and added them to ArrayLists, which I printed out to a different sheet. (The goal is to print it out to an excel sheet)

But this method is making me store and iterate over millions of objects.

Is there any method to add all records dynamically in an easier less time consuming way and send it to the sheet?

  • 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-16T10:51:32+00:00Added an answer on May 16, 2026 at 10:51 am

    It would be something like that:

    PreparedStatement stmt = cnt.prepareStatement("...");
    try {
        /* ... */
        ResultSetMetaData meta = stmt.getMetaData();
        Object row[] = new Object[meta.getColumnCount()];
        ResultSet rs = stmt.executeQuery();
        while (rs.next()) {
            for (int i = 0; i < row.length; ++i) {
                row[i] = rs.getObject(i+1);
            }
            processRow(row);
        }
    } finally {
        stmt.close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am fetching records from MySQL database using Java (JDBC). I have tables -
I am using jdbc to select data from a mysql database. I am performing
connecting to a mysql database from java using jdbc. declaring a query String query
I am running a query on a MySQL database, I am using JDBC and
I want to handle a MySQL database using JDBC from inside an operation of
I created a simple mysql database table using following query: CREATE TABLE customer( name
I'm accessing public mySQL database using JDBC and mySQL java connector . exonCount is
I'm using groovy gsql to query to Mysql database. Everything goes well on localhost
trying to query mssql database using JSP. connected the database using ODBC but this
I'm using JDBC to insert a row into a MYSQL database. I build a

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.