Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!

Ken Matson

+ Follow
since Mar 01, 2018
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ken Matson

Paul Clapham wrote:I usually find that asking why something is implemented in a particular way is fruitless -- even if you find out, it's still going to be implemented in that way. In the end you have to write your code to match the implementation of that thing anyway.

granted ... but can you tell me anyway, in line 3, i can call something to tell me that "Alice" is now the current/pending value for that field in that row? Thanks!
I'll have to check out next week - gonna be out for several days here ... THANKS!

Paul Clapham wrote:Actually, after I read the API docs, I found out that Oracle's RowSet tutorial tells you to do exactly what I suggested. It doesn't mention com.sun classes at all.

(I always by preference read the Oracle tutorials before anybody else's tutorial.)

isn't JdbcRowSetImpl  from the sun library?
Hi ... so i have a result set "rs" ... CONCUR_ UPDATEABLE and SCROLL-SENSITIVE ...  can anyone explain this behavior to me?

current row has column firstname ... value "Bob"

1. System.out.println(rs.getString("firstname"));  ..... prints "bob" as expected
2. rs.updateString("firstname", "Alice");  runs, no errors
3. System.out.println(rs.getString("firstname"));  ..... still prints "bob"???
4. rs.updateRow(); ... runs, no errors ... database is updated to "Alice" as it should be
5.  System.out.println(rs.getString("firstname")); it prints "Alice" - which is correct

So the questions is, why did i have to update the database with updateRow() before getString() would return the correct new value from the ResultSet? And where is "Alice" stored until I updateRow() ?? IOW, how do i get something to retrieve and print "Alice" in line 3?


Paul Clapham wrote:

But you might want to try addressing the "limitations" you found in some other way. Would you like to ask that question here?

Hi thanks! Well - the specific limitation I was trying to overcome is a way to "revert" a row in my ResultSet back to it's original values w/o having to go back to the database. I don't see a way in a ResultSet , but a RowSet seems to support this?

also - the idea of being able to use a RowSet in disconnected mode and only reconnect when time to update the back-end seems like a positive for my situation that a ResultSet can't really do?

Still learning here ...

I have my little app's first form/screen working with a ResultSet from my database. After running into some limitations, my research yielded that perhaps I should be using RowSets instead. The issue seems to be that all the implementation classes are part of Sun libraries that I'm warned not to use in an application because it is an "internal proprietary API and may be removed in a future release".

Every example I see uses these. In fact, some point out the warning, and then tell you how to do it? I'm confused ... it's like it's saying "here's how to use RowSets, and by the way, don't use RowSets." Please help - if I want to use RowSets, is there some "correct" way to do it that is different than these examples? How do I create RowSet instances w/o using those Sun libraries?

OK - coming along in my Java education, and appreciate help I've received here! I have always been a "data centric application" programmer, and I'm really struggling trying to find tutorials on how to do simple (or what should be simple) binding of form controls to data in a ResultSet. Here's what I'm looking to do.

I can successfully retrieve data from my database (PostgreSQL), and store that result set on my form controller. My form is a simple data maintenance form  - let's say an "Employee" form. I have  text fields for first name, last name, and title. I know I can manually set the text of those text fields to equal the corresponding column (of the current row) in my ResultSet, however, got to be a better way right? What I want to do is BIND the value of each textfield to a column of the result set so that anytime I change the row of the result set, all the textfields automatically update, and so that if I type in a textfield, it auto-updates the corresponding row/column in the ResultSet. I'd have Next and Previous buttons on the form to move to the next/prev row and expect the form to refresh accordingly to display the current row's data.

To me - perhaps because of my background, this is the very most basic, "form 101" thing you can do in an application, so I'm surprised I can't find anything with a simple, straightforward tutorial on it? Please help!


2 days ago
Thanks. I got it figured out by setting the classpath in netbeans. I was getting frustrated because all the research I did kept telling me the set the classpath, and nobody told me how to actually do it.
Ok - new to java and this is killing me - wither my brain quit working or I'm missing something basic.

I downloaded and installed PostgreSQL - I created a new database , tables,, and added data via the management tool that came with it ... pgAdmin4 ... all is happy there.

When I try to connect from my code, I get a "No suitable driver found for jdbc:postgresql://localhost/mydatabase" error. My research finds a lot of talk about "Classpath" and "registering driver". I'm confused as I Dont know what/how to work with those things. Do i need to move the driver somewhere? Do I need to point to the driver from my code? Heck - what is even the name of the driver file and how do i find it? I'm really lost.... sorry!

Thanks for any help!
I got it figured out thanks to some online searches. Basically what I'm doing is getting a reference to the controller for the form, and referencing variables there through getters. The buttons themselves Can update the variables. Thanks for the help everyone!
1 week ago

Just learning JavaFx and Scene Builder. So I'm successfully presenting a simple form which was designed in Scene Builder. It has several buttons, all of which simply close the form. Great - they work fine. What I need to know is how the method that called/opened this form can know which button was clicked? eg how do I pass back which button was clicked to the calling program?

1 week ago

Chris R Olsen wrote:Ken --

  I was in your shoes a couple years ago!

  What saved me was the book, Learn Java FX 8 by Kishori Sharan.  It is totally marvelous!

  A decision I made, which you may or may not, was to NOT use the SceneBuilder until I had a clue what was happening under the hood.  (Here is where the Sharan book was really good for me).  I still, a couple years later, do not use the SceneBuilder, but I suppose I might in the future.

  -- Chris


Thanks - I'll take a look. At the moment - I've just kind of looked at all this as a "black box" and am putting my code in it. At least I'm making progress on my app that way!
2 weeks ago
THANKS! Works well
2 weeks ago
Hi - brand new to JavaFAX, and for that matter, to Java period.

I started out building a Swing GUI, and almost had my head around that when I learned that JavaFX was the "future". So, I switched to trying to learn and use that and have been quite frustrated. Most of the examples I find and copy/paste into my editor don't work - error all over the place. I think a lot of that is because the people writing the samples/example never bother to talk about context or required imports, etc.

Even if I get the imports sorted out, I still get a lot of errors, and I THINK maybe I'm beginning to understand why, but want to verify this.  It seems that the JavaFX forms (scenes? stages? windows? whatever they're called) created by FXML/Scene builder, don't want to work except in the context of a JavaFX "Application" - that is, a class that extends "Application". Is this correct?  In addition, I can't get it to work except within (or called from) the "start" method. Is that right?

If so, that means there is no way to simply do a quick alert dialog w/o it all being wrapped up in this stuff? This seems awfully clunky IMO. Can I mix FX with the Swing stuff? All in the world I want to do is have a simple dialog box come up with Ok/Cancel buttons. In many/most other languages, this is as simple as something like:

which can be called from anywhere , anytime. Does Java have something like that? Please advise. THANKS!
2 weeks ago
Hi - new to java and NetBeans IDE.

One of my biggest frustrations in researching examples, reading tutorials, etc.  - which I'm doing a lot of in trying to learn Java ... is that they almost never seem to tell you what packages(?) need to be imported to run the code they are showing.  And even if they do, it's difficult (for me at least) to understand where a class/method is coming from. I'll see something like FooClass or fumMethod doing stuff, while having no idea where it is defined? Is this just a matter of grasping this stuff by osmosis over time, or am I missing some simple way to divine this information?

Related to this - and perhaps this is a  NetBeans specific question, is there a way to "Switch to" the class/method definition/file by highlighting a class or method name and typing some key shortcut or something?  Also - is there anyway to highlight a keyword or class name (for the base java classes I guess) and get some sort of language reference? In fact - is there language reference at all anywhere? I'm talking something like this (from SQL Server documentation - I pulled this at random):

Thanks - making progress - but too slowly and getting frustrated ....

2 weeks ago