Results 1 to 6 of 6
Thread: Result set not returning values
- 10-07-2009, 12:51 AM #1
Member
- Join Date
- Oct 2009
- Posts
- 15
- Rep Power
- 0
Result set not returning values
hi all,
i have a paculiar prob in my code..
i have a method that has the DB connection param.. connects to the DB.. retrieves data and sends it across..
All connection parameters are correct
Data is available in the table
Data is retrieved when the statement is run on DB client pl sql editor.
but rs.next() returns false
what could be the issue ???
below is the code..
public void getEventKeys() {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
// This is format for below string
// jdbc:oracle:thin:@//host:port/service
String url = "jdbc:oracle:thin:@//cola094-vip:1521/XRDEV";
// username: scott
// password: tiger
Connection conn = DriverManager.getConnection(url,"scott", "tiger");
conn.setAutoCommit(true);
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery("select my_key from my_trigger");
while (rset.next()) {
System.out.println ("There is data!");
}
stmt.close();
}
catch (Exception e) {
System.out.println (e.getMessage());
}
- 10-07-2009, 01:59 AM #2
Does your code throw an exception?
If the query executes without exception it can only be assumed that "my_trigger" contains no rows. You might want to check that it has rows first.
Edit: you might want to put in a message somewhere in getEventKeys() to verify that you are actually making the call to that method.Last edited by mrmatt1111; 10-07-2009 at 02:01 AM.
My Hobby Project: LegacyClone
- 10-07-2009, 02:14 AM #3
Member
- Join Date
- Oct 2009
- Posts
- 15
- Rep Power
- 0
i ran the code in debug mode.. everything seems fine.. only thing is that the resultset.next is not returning true.. and yes data is there in thaat table...
- 10-07-2009, 07:28 AM #4
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Well, there's nothing wrong with that code (other than the fact that you are not closing the resultset or the connection, and that, as well as the statement close, should be taking place in a finally block).
So, when you check that the "table exists" and "has rows", are you using the same user and password you are there (different users have different rights) and are you connecting to the same IP, port, and SID. Stupid questions, but they need to be asked because the Orcale driver does not simply ignore them.
If the answers to those questions are yes, then find an Oracle DB forum, as the problem is with the Driver and not with either Java or JDBC.
- 10-07-2009, 09:46 PM #5
Member
- Join Date
- Aug 2007
- Posts
- 4
- Rep Power
- 0
Do you have the ability to perform comparative tests with a 3rd-party JDBC driver? If not, can you enable JDBC tracing against your current JDBC driver to determine why the rs.next() function call is failing?
Best regards,
Netrista Khatam
Tech Services Manager
OpenLink Product Support
- 04-14-2011, 05:24 AM #6
Member
- Join Date
- Apr 2011
- Posts
- 1
- Rep Power
- 0
Similar Threads
-
problem on returning values..
By kulangotski in forum Advanced JavaReplies: 11Last Post: 03-07-2009, 02:13 AM -
beginner grade 11-need help with a math code involving returning values from a method
By bobmasta5 in forum New To JavaReplies: 3Last Post: 12-10-2008, 01:38 AM -
[SOLVED] Beginner, need help with Returning Values from Methods
By bobmasta5 in forum New To JavaReplies: 11Last Post: 12-08-2008, 12:29 AM -
Retaining DB values as well as Dynamically generated Values.. Help Needed !
By rajivjha in forum Advanced JavaReplies: 0Last Post: 05-22-2008, 10:53 AM -
How to add interceptor to persistent ejb entity to add check before returning values
By umen in forum Enterprise JavaBeans (EJB)Replies: 0Last Post: 11-30-2007, 11:55 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks