473,387 Members | 1,592 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ResultSet.getStatement returns null in some cases.

dmjpro
2,476 2GB
I am trying out to find out how many Schemas are there in a Database.

Expand|Select|Wrap|Line Numbers
  1. ResultSet schema_rs = db_metadata.getSchemas();
  2.  
  3.         while(schema_rs.next()){
  4.             String schema_name = schema_rs.getString("TABLE_SCHEM");
  5.             System.out.println("Schema Name: " + schema_name);
  6.         }
  7.         System.out.println("Yahoo: " + schema_rs.getStatement());
  8.         schema_rs.getStatement().close();
  9.  
Actually i read out API there it is told that if the ResultSet generated some other way as for example, through DatabaseMeta then it returns null.
Here it matches the condition.
Here no Schemas found ...and here I am using MySQL.
If i tried with some other database so far I tried with PostgreSQL and Sybase.
There I found some Schemas and there the ResultSet.getStatement does not return null as it generated through DatabaseMetadata.

Is it database dependent?Or if no schemas found then it happens.
Or it is a specific problem with MySQL?

Debasis Jana.
Apr 24 '08 #1
2 2806
Dököll
2,364 Expert 2GB
What does Google have to say about this? Have you tried there? I do not use MySQL so I could not tell you. Just making sure your question is answered:-)
Dec 21 '08 #2
JosAH
11,448 Expert 8TB
Your question is quite chaotic; read the API documentation for the ResultSet interface:

Retrieves the Statement object that produced this ResultSet object. If the result set was generated some other way, such as by a DatabaseMetaData method, this method may return null.
You didn't get your ResultSet by a Statement and hence the source Statement can be null.

kind regards,

Jos
Dec 22 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Jonathan Beam | last post by:
I'm trying to create a wrapper procedure. The procedure I'm calling returns 2 resultsets. I really only need the second, but I'm not sure how to get the second resultset. Is there something like...
0
by: Srinivas.Gajula | last post by:
Hai, For Example Below are two storeprocedures one returns resultset and other not, how get this information through programmatically. 1)CREATE PROCEDURE dbo.UpdateCustomers (...
0
by: Eckard Buchner | last post by:
Hi, we have a query that returns only a few rows, but has a lot of columns in group by clause. In some cases we receive an SQL Exception. Here is the trace setString (1, 20040928001) called...
3
by: Koen | last post by:
Hi, first of all, the machine setup server 1: - UDB2 7.2.5; COUNTRY=1, location = US, IBM1250 codepage - Locale: US English; Regional Settings: English; Keyboard: Dutch; decimal separator: ....
12
by: robertino | last post by:
Hi all, I've put together a few SPs to produce a BOM (bill of materials) listing, which together use a couple of global temp tables, and return the results from a cursor. Here's the code: ...
0
by: David Linsin | last post by:
I created a simple test case to reproduce the problem (also check Bug #15500): import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement;...
6
by: abctech | last post by:
My requirement is such that any user must not be allowed to save the same record twice. For this what I do is as soon as some user fills up the page and clicks 'Save' I invoke a Servlet which...
6
by: joerg | last post by:
Hello world, my program connects to a db2 database and needs to find out the column names and data types for a specific table. The code works fine with mysql and derby, but returns an empty...
0
by: av~ | last post by:
Hi All , I am trying to call a db2 stored proc with cursor open from my java code but it always returns me null results though it executes fine when I call the procedure from the command line ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.