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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:58:35+00:00 2026-06-09T16:58:35+00:00

I want to make Java code (using Oracle 11g and JDBC also) which will

  • 0

I want to make Java code (using Oracle 11g and JDBC also) which will check if a particular User or Schema exists or not. How can I do this by using only Java code and not by executing SQL queries (inside my java code) to do the checking ?

Thanks.

EDIT –

METHOD 1:

In MySQL, we can use something like this –

Connection conn = DriverManager.getConnection(url,username,password);
DatabaseMetaData DMD = conn.getMetaData();
ResultSet res = DMD.getCatalogs();
 while (res.next()) {
      String database = res.getString("TABLE_CAT");
}

Now put an if inside the while to check it given DB exists.

METHOD 2:

OR, you can execute some queries like mentioned in this post.
Using SQL query to determine if a table exists

I want to use something like method 1 to do the job instead of method 2 – That is what i meant.

  • 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-09T16:58:36+00:00Added an answer on June 9, 2026 at 4:58 pm

    The pure JDBC way to interrogate the database about this sort of thing is to use the DatabaseMetaData class in your Java application. DatabaseMetaData.getSchemas will give you the set of schemas in the database. DatabaseMetaData.getTables will give you a listing of the tables. You can write code that iterates through these ResultSet objects to see if a particular table or schema exists.

    Of course, behind the scenes, the JDBC driver is simply executing SQL queries against the Oracle data dictionary to get this information.

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

Sidebar

Related Questions

I want to make a kml file from a java code using jdom-1.1.jar library
I want to make an FTP connection (ideally using Coldfusion 8, but Java is
I want to make discussion form kind of website using java, should i just
I have created a web system using Java Servlets and now want to make
Hi I want to design a class using Groovy Sql which I will be
I want to make a synchronous call to some Java code in my Android
I'm using DESede encryptation in Java and I want to make the same encryptation
I want to make java code that does only this: Login to the 'xe'
I want to write Java code to work with a database, no matter which
I want to make Java JDialog appear like it is presented in the image

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.