Michael Craghead

+ Follow
since Mar 12, 2006
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 Michael Craghead

Jayesh A Lalwani wrote:I don't think you can pass cursor name as a parameter to a PreparedStatement. Why are you doing it this way as oppossed to

I cut out the actual processing details from what I'm trying to do to eliminate clutter. I don't want to set itim_updated until I've done my processing. I'm iterating through my result set, doing some processing based on the current record, then updating itim_updated (record has been processed). I don't want to update all of the records with recertstatus = 'S' and itim_updated = 'N', as some records might not be processed successfully. Think of it as each row in my result set as a transaction. I hope this is clear.


I'm trying to create a prepared statement that uses '?' for substitution. The problem that I'm having is that I get an error during execution indicating that there is an invalid "?" in my Update statement. It's right when I try to create the prepared statement:

com.ibm.db2.jcc.b.SqlException: Invalid cursor name "?" in the Update/Delete statement.
at com.ibm.db2.jcc.b.tf.b(tf.java:312)
at com.ibm.db2.jcc.b.tf.<init>(tf.java:259)
at com.ibm.db2.jcc.c.dc.<init>(dc.java:93)
at com.ibm.db2.jcc.c.b.b(b.java:1840)
at com.ibm.db2.jcc.b.p.a(p.java:2124)
at com.ibm.db2.jcc.b.p.prepareStatement(p.java:1017)
at com.mytest.commit.Commit.main(Commit.java:41)

Is cursor name substitution not valid in a preparded statement, or maybe in a DB2 prepared statement? I'm guessing that maybe something that I'm overlooking in my update string that is causing the problem, but I just can't figure out what it might be. It doesn't seem to complain about the other '?' in the update string.

This is what I have:

Thanks for the help.

I ordered my copy of Essential JavaFX the other day when I heard about it. I can hardly wait to get it.

Michael K. Craghead
13 years ago

Originally posted by William Brogden:
Exactly what do you need to validate? If Axis does not throw an exception than the SOAP message is valid XML.

Are you working with somebody else's SOAP service or do you have control over the service too?


All of this web service stuff, and even Java to some extent, is new to me, so hopefully I can explain it without being confusing.

I'm actually working on validation as it relates to JMS messages in a test application. The test application allows users to simulate requests coming in from clients without needing them to come in from the out side. The application allows SOAP requests that are manually created to be placed on various queues that simulate coming in from clients. My intent is to allow the user to validate these requests since they are hand-made, but they include the SOAP part and not just the request message. I have a schemas that I'm validating against for a given request type.

Was that clear? I hope so, as I'm still learning so that's kind of the best that I can explain it. If not, let me know and I will try and clarify or find an answer.

14 years ago
I'm trying to figure out how to properly strip out the XML from a SOAP message so that I can validate it.

I guess I have a multi-part question. First, I've parsed the original SOAP message and have it represented as DOM Document because the examples I looked at did it that way, but based on some of the things that I've read about since I created my code it looks like SAX might be more efficient since I only need the XML from the SOAP message. Should I use DOM or SAX (at this point I really just want it to 'work')? Second, how do I strip the XML out of the SOAP so that I can validate it? I think I have the validation code. I just need to strip out the XML so that I'm only validating the XML.

I'm using AXIS2 if that makes a difference. Thanks.
14 years ago
Never mind. I see now that getResourceAsStream() is not only the method in class MessageTest, but also a method in class Class. Now it makes sense. Thanks.

14 years ago

Originally posted by Rob Prime:
MessageTest.class just returns a Class object. It's like calling getClass() on an instance of MessageTest, but without the need of an instance.

OK, but I still don't see the point of the following in the getResourceAsStream method:

final InputStream stream = MessageTest.class.getResourceAsStream(name);

It looks like it's getting the class object in order to call getResourceAsStream(), when getResourceAsStream is already static, and you're already inside the method. I guess another way to put it is, why do I need a class object to call a method that I'm already in? You've still lost me.

[ September 25, 2008: Message edited by: Michael Craghead ]
[ September 25, 2008: Message edited by: Michael Craghead ]
14 years ago
I ran across this code at work and I don't understand it:

I even read the section in "Just Java 2" and still don't understand what's going on. The class that this method is from is MessageTest. It looks like it would be recursive, but I don't think it works that way. If it's not recursive it doesn't look like it does anything. I'm probably overlooking the obvious, but please point me to the obvious. Thanks.

[edit]Add code tags. CR[/edit]
[ September 25, 2008: Message edited by: Campbell Ritchie ]
14 years ago

Originally posted by Theodore Casser:
For what it's worth, there is a precedent already for not having an exam for a given version of Java SE - there wasn't a specific exam for the 1.3 version of J2SE. It might not be in the cards for 6 either.

Not that I'd mind having that excuse to book up on what's changed since 5.0 came out, but that's neither here nor there...

I don't know that I would call it a precedent as the SCJP exams are specific to a given version of Java. The question is whether they will have a version of the exam for Java 6. They very well may decide there is no reason to do so or that it's not in their (Sun's) best interest. I have heard a few authors say that they really didn't think there was enough new in Java 6 to justify writing a new version of a book for Java 6. You might be right though. They might not do a new version of the SCJP for Java 6.
How long do you think it will be before Sun updates the certification exams to reflect Java 6? Any guess, informed or otherwise? Thanks.
So, what did you think of it? Was it hard? Easy? If hard, was it harder than you thought? Thanks.
15 years ago
I've seen some databases that suffered from very poor design, often times having been designed by individuals who were much better at coding than data design. In some cases I doubt they had even heard the term "normalize".

How much can refactoring help a poor design? Maybe a better way to put it is, at what point do you scrap your current design, start from scratch, and refactor as you go?