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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:51:54+00:00 2026-05-18T02:51:54+00:00

I want to run a query on an Oracle database and for each column

  • 0

I want to run a query on an Oracle database and for each column in the result set, I want to know the schema that the column came from. I tried the following:

ResultSetMetaData rsMetadata = rs.getMetaData();
String schemaName = rsMetadata.getSchemaName(1)

However, this returns an empty string. Is there any work around to get the schema name?

Edit in response to OMG Ponies:

The tool we are developing takes data from a database and analyzes the data to find the most informative subset for a given question. We then create a query which returns only the rows that are informative for the given question. For instance if we had a customer database and wanted to know which customers are most likely to discontinue their service, our tool can create a query which returns 5% of the customer records which can then be run through high powered analytics algorithms. The benefit is that we run our analysis on only a subset of the data which of course will save time. It turns out as well that the high powered analytics algorithms work better now because the first step was essentially filtering the noise out of our data.

So in response to OMG Ponies, the user specifies the database connection information and query as inputs to our tool. Because they can specify any query they like, it would be possible for a user to connect to connect to schema foo, and then run the following query:

SELECT* FROM bar.customer;

If for some reason eye color and gender were predictors of people discontinuing their service, the resulting query that our system generates might look like this:

SELECT * FROM bar.customer WHERE bar.customer.eye_color='blue' 
                                 AND bar.customer.gender='M' 

It would be nice to know the schema for each column in the results set so we can make sure our query will run correctly. We could assume the schema is the same as the schema used in the database connection and that should be fine 99% of the time. I’m just concerned for that 1% of the time a user might do something unexpected like run a query against another schema.

  • 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-18T02:51:55+00:00Added an answer on May 18, 2026 at 2:51 am

    According to an old Oracle code sample:

    OracleResultSetMetaData interface does not implement the getSchemaName() and getTableName() methods because underlying protocol does not make this feasible.

    That implies to me that ResultSetMetaData will not have those methods for an Oracle either, at least when using an Oracle driver. (I tried with the OCI driver to see if that made a difference, but apparently not).

    There’s a WebLogic 8 document that suggests it could be done, but that type 4 driver has been deprecated in later releases. So it’s possible you may still be able to find a third-party driver that supports getSchemaName() against Oracle, but it seems unlikely.

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

Sidebar

Related Questions

I want to run a query like this: SELECT * FROM table WHERE field
I want to run this query in Android Application : SELECT field1 FROM table1
I have an Oracle table with two columns ID and START_DATE, I want to
Now, I'm pretty sure that it's not possible, but I want to 1) Confirm
I need to copy data from one database into my own database, because i
I have multi databases with same structure its name like that Client1234 the different
I've pieced together some information from other posts but I'm stuck. The first part
I have a combo box and several text boxes on a form. When I
I'm filling a drop-down list using the following: var columnNames = db.Mapping.MappingSource.GetModel(typeof(StaffDirectoryDataContext)) .GetMetaType(typeof(Person)).DataMembers; I'm
Let's say I have players table. It consists with 3 rows(it has much more,

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.