Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

spot the error

 
Master Rancher
Posts: 594
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


The derby database has a table called Events which has a boolean field called hasOverShoot

I am getting to 30 BUT not 31
Bob M
 
Saloon Keeper
Posts: 8447
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is your Exception message? If you don't have one then that's what you should work on next.
 
Carey Brown
Saloon Keeper
Posts: 8447
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here's the FETCH syntax I found:
Could it be you need to use "ROWS" and not "ROW" ?
 
Bob Matthews
Master Rancher
Posts: 594
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think ROW is OK

StackTrace coming up
 
Carey Brown
Saloon Keeper
Posts: 8447
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't worked with cursors but the FETCH doc I was reading said that if you end it with "ONLY" that tells the DB to close the cursor after executing that statement. It looks like the next thing you are trying to do is use the cursor, which is probably closed.
 
Bob Matthews
Master Rancher
Posts: 594
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Carey

As usual I am copying an earlier program which I believe updated the last record in a table with those commands

Still waiting for conditions to yield StackTrace
 
Saloon Keeper
Posts: 24189
166
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carey Brown wrote:I haven't worked with cursors but the FETCH doc I was reading said that if you end it with "ONLY" that tells the DB to close the cursor after executing that statement. It looks like the next thing you are trying to do is use the cursor, which is probably closed.



This isn't a stored procedure unless my eyesight is worse than usual - so no cursors, just a ResultSet - which isn't the same thing.

I'm going to have to take it that this is Bob's infamous app that "loses" the stderr stream so he has to manually grab the stack trace. I wish he'd fix that.

In any event, that is some really questionable-looking SQL so we also would benefit by knowing what brand of database he's using. I know, it was mentioned in an earlier post, but I'm too lazy to go dig it up.
 
Carey Brown
Saloon Keeper
Posts: 8447
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think he mentioned Derby way back. Would have to double check with the OP. What do you say Bob?
 
Carey Brown
Saloon Keeper
Posts: 8447
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, "MYCURSOR" is, of course, not the same as "CURSOR". We don't know where MYCURSOR comes from.
 
Carey Brown
Saloon Keeper
Posts: 8447
71
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I also prefer the convention of writing SQL with keywords in all-caps and non-keywords in lower case.
 
Tim Holloway
Saloon Keeper
Posts: 24189
166
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carey Brown wrote:I think he mentioned Derby way back. Would have to double check with the OP. What do you say Bob?



Yeah. Thanks. Glad someone has a memory!

And no, I don't recognize that as a valid Derby UPDATE command.
 
Tim Holloway
Saloon Keeper
Posts: 24189
166
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Carey Brown wrote:I also prefer the convention of writing SQL with keywords in all-caps and non-keywords in lower case.

As do I. Different databases have different ways of handling database entity names with upper case in them. You can get into a lot of trouble that way.
 
Bob Matthews
Master Rancher
Posts: 594
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello guys.............

Derby it is

Do I get a cup for the worst programming ever

I am tickity-boo now, the program is writing out records all good

After a week of this quiet running I shall stop for the weekend and check out all these new records

I may leave you alone for a while now...........I know, it's hard to believe

The topic of all this programming is Directional Changes in the Forex market

There are at least a dozen current academic papers on the subject

So it's goodnight from me and goodnight from him

Carey - I hope you NEVER have to request a StackTrace again

Cheers

Bob M (a very happy 74 year old)
Dunedin (in Havelock at the moment on board my yacht)
New Zealand
 
Bob Matthews
Master Rancher
Posts: 594
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
why did I speak too soon



console output:

Time               Messages                                                    
2021-08-17 05:30:01 java.sql.SQLException: Invalid cursor state - no current row.
2021-08-17 05:30:01 we get to here - 33:                                        
2021-08-17 05:30:01 we get to here - 32:                                        
2021-08-17 05:30:01 we get to here - 31:                                        
2021-08-17 05:30:01 Successfully retrieved the latest record from EVENTS table:  
2021-08-17 05:30:01 we get to here - 30:                                        

get to 33 BUT not 34 ?

Bob M
 
Bob Matthews
Master Rancher
Posts: 594
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think I have found the culprit

The Events table k value jumped from 174 to 7194 ( a number associated with the other PRICES table

Have corrected the last record in the EVENTS table

whew
 
Tim Holloway
Saloon Keeper
Posts: 24189
166
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Congratulations on your breakthrough! Hope that this time it's well and truly fixed.

But should you find yourself bored, do try and locate where the stderr output of your app is being sent. Having to constantly put print statements in all over the place and manually outputting the stack trace is a lot of work for you and takes a lot of time. It would be less painful for you if you could just find that error output at the start.

Incidentally, in the Bad Old Days, I had to do exactly what you've been doing to debug programs. Back then, though systems didn't produce stack traces. They just died. And perhaps left a voluminous memory dump. Nowadays we have Intelligent Development Environment (IDE) software with interactive debuggers. So we can step through code line by line, inspecting variables as we go and capture the stack trace the moment it happens. I doubt you'd want to go to all the trouble of learning an IDE, though, since you're not doing this as a profession. But that's how we do it for a living.
 
Bob Matthews
Master Rancher
Posts: 594
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Tim

I do use Netbeans IDE and so I need to learn the debugging aspects further

I guess one of my problems is that I run my programs on Dukascopy's trading platform and IT will have it owns idiosyncracies
 
Tim Holloway
Saloon Keeper
Posts: 24189
166
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Fun fact: the "real" debugger is part of the JVM. What IDEs like NetBeans do is provide a GUI front-end to it. However, you'd have to be really old-school to want it otherwise.

If you're never getting stack traces when using NetBeans to run your app, you've probably closed the NetBeans Java Console windowpane. I'm not a NetBeans expert, but usually there's a "Window" menu that controls that.

We do have good NetBeans support here, by the way. If you need help, just ask in the NetBeans forum!
 
Won't you be my neighbor? - Fred Rogers. tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic