Ed Wallen

Ranch Hand
+ Follow
since Feb 11, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Ed Wallen

This is an informational post for anyone connecting to a DB2 v. 7 database on OS390 via JDBC.

I have confirmed a bug in the DB2 software that prevents the database engine from successfully determining if a statement is eligible for the prepared statement cache when the SQL string contains leading spaces or lines. This was causing a huge performance problem, as 70%+ of our database CPU time was being spent constantly doing prepares. As far as we know right now, this is not documented by IBM. The DB2 developers have come up with a usermod, but this is not packaged in a formal patch as of yet.

In the interim, we have a very easy workaround that will make the DB2 database engine happy and will successfully allow it to cache prepared statements (I should note that we also go against an Oracle database------it has no problem caching the prepared statement as is). Many OR mapping frameworks use XML as their means of defining and describing how data on the database maps to the Java application objects. In the framework my team is using, we just removed the leading space within the XML persistence configuration documents. An example of the change is below:

Before:




After:



Hope this helps out if you find yourself in this situation.

-Ed
[ August 22, 2005: Message edited by: Ed Wallen ]
Ilja, I disagree.......you often don't know the type of an object at compile-time. This is especially true if you are writing a flexible system with pluggable components.

-Ed
[ April 08, 2005: Message edited by: Ed Wallen ]
20 years ago
Michael,

Here is a method that I wrote in one of my framework utilities. This is a simple way of making a deep copy. If performance is critical, there are faster ways of doing this.........but this should get you past your problem.



Hope this helps.

-Ed
20 years ago
The Connection Timeout is how long a thread will wait for the connection pool to give it a connection (not how long the database transaction takes).

You are not able to kill the thread from the WAS layer............you could however create some solutions at the database layer to keep your processes from running away. As far as you transaction goes, you can set the transaction timeout at 3 seconds, but that does not mean that the thread accessing the database is going to stop processing.

-Ed
20 years ago
For any object instance you can call to return the fully-qualified class name. For primitives, first wrap in their corresponding wrapper types.

-Ed
20 years ago
Can you provide more information?

I believe the WebSphere servlet container relies on the classloader hierarchy being "PARENT_FIRST" in order to properly compile JSPs. Make sure yours is set to this.

-Ed
20 years ago
Due to this issue, some of the primary key Integers that got inserted into the database fell victim to this IBM bug. I had to provide the application team with a means of converting the identifier to the correct value (reversing the bytes). Here is the simple class that I wrote:



-Ed
[ April 01, 2005: Message edited by: Ed Wallen ]
20 years ago
Create an intermediary between your application code and the HttpSession (meaning a class that manages all of your getAttribute/setAttribute calls). This intermediary will be the only object in your web app that has knowledge of where your Vectors (or any other object) are stored within the session..............so if you wanted to make sure that you are only keeping X number of Vectors in your session at a time, your intermediary can manage this using several different strategies. You could always have the intermediary set the Vector in the session using the same key, ensuring that only one Vector is maintained. Another way is to have the intermediary actually store a java.util.Map in the session and use the Map to house your Vectors. When you wanted to get rid of all of your vectors, you could just retrieve the Map from the session and call clear() on it. Hope this gives you some useful ideas.

-Ed
20 years ago
JSP
In general, you should use those objects provided in the new Collections API (since 1.2). If you need a collection implementation to be threadsafe, use the java.util.Collections class. Collections consists exclusively of static methods that operate on or return collections. The methods that begin with "syncronized" will return you a threadsafe collection implementation (list, set, map, etc.).

-Ed
Right click on the archive (jar, war, etc.) and select Properties. Go to Java Source Attachment and point to where the source resides.

-Ed
20 years ago
Do you have indexes set up at the database level??? Do you really need to retrieve 40,000 rows? Take a look at implementing paging. You'll need to post more info in order for any of us to be of more help.

-Ed
Do not use double-check locking for your Singleton getInstance() method. The bottom line is that double-checked locking, in whatever form, should not be used because you cannot guarantee that it will work on any JVM implementation. JSR-133 is addressing issues regarding the memory model, however, double-checked locking will not be supported by the new memory model.

Read this article:

Double-check locking and the Singleton pattern

-Ed
Go into your system classpath. Put the Java JDK in front of the Oracle JDK. Open a command prompt. Type "java -version". Should be 1.4.2_07.

-Ed
20 years ago
Has anyone successfully used IBM's WSDL2JavaTask and/or Java2WSDLTask??? If so, could you please post a script example.............I'm having a tough time finding any decent documentation on this. Thanks!

-Ed
20 years ago
Surasak,

In response to your post:


return(y=z);

The above code is legal if y and z are boolean variables.



y & z do not have to be booleans. This is an assignment operation. This will work as long as z is assignable to y. However (I'll repeat again), even though this works it is sloppy coding.

-Ed
20 years ago