Les Hayden

+ Follow
since Jun 19, 2002
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 Les Hayden

Careful how you handle the connections...

I notice there is at least one place where you null the object before closing the connection object. I would be concerned about how a simple system like access will handle that occurrence. It might not present a problem, but I would not take the risk on something critical like a hospital system.

Your solution would only yield reliable information if the following was true:

  • There is only one user updating the database at any given time
  • Each file uploaded results in one and only one row

  • As Paul points out, a more reliable way would be to mark the table with user ID and a date-time stamp.

    Is there a reason that you could not track the number of tables in an instance variable?

    I have not tried to use that feature of JDBC, but here is my opinion:

    In DB2 schema is also your ID in the database. I would doubt that DB2 will let you sign on and then change the schema. Changing the schema before signing on, would serve no purpose.

    I typically use the schema.objectname form of referencing database objects in DB2. So if I were doing a select from table XYZ in your example I would use the following SQL:

    SELECT col1, col2

    You can also execute a command in DB2 to access another schema from your schema without using the schema prefix, but if there are objects with the same name in your schema, you will have to use the prefix to resolve the ambiguity.

    The other alternative would be to login directly to the ABC schema. However, if that is a production schema, many companies restrict access to the schema.

    Hope this helps,
    Could you explain more what you mean by "access schema?" Do you want to find the schema name? Do you want to access the data in a particular schema?

    One of the folks in our group received the following at 11:00 a.m today

    13 years ago
    Each request to the server becomes a separate thread. That is why it is important that each Servlet is thread safe. You might have several users in the same object at the same time. Don't forget that the only things your servlet classes know about the session is what it gleans from parameters passed to it when its methods are called.

    However, there is no reason that you cannot spin off additional threads. You have the responsibility of coordinating the threads.

    An example of how we use threads is when some events occur, we have to notify several people via e-mail and voice message. We spin off threads to manage that process because the user does not need to know about or wait for those actions to occur. If we wanted to we could tie them to the session by passing the parameters such as HttpServletRequest to the threads when we spin them off.

    Does that help?
    [ November 14, 2007: Message edited by: Les Hayden ]
    Here's my logic...

    First you set active workflows to new HashMap when you enter getActiveWorkflows().

    You have only one return statement and it returns activeWorkflows. Therefore, if your method ever returns, activeWorkflows cannot be null.

    While your getActiveWorkflows() method handles the SQLExceptions with a catch( Exception e), it then re-throws the exception as a XFlowException.

    By throwing the exception to the calling method, you would cause the activeWorkflows in the calling method to be null because no value is returned from the getActiveWorkflows() method. You just log the exception and continue.

    From the code you gave us, that is the only way that the value could ever be null. In the code below activeWorkflows is undefined

    I'm afraid that your description of the problem and your code snipits are not lining up for me.

    you say

    put a close statement in the DbInsert class method

    but in your code you use connection.close();. If you indeed want to close the statement then you should use

    I get activeWorkflows=null, but according to the database this activeworkflow can never be null

    Actually if your method getActiveWorkflows() throws any exception, activeWorkflows will be null. Are you seeing any stack traces, if so, they would be useful to resolving the problem.

    Also, I can't speak for anyone else, but formatting your code would make it much easier to read and assist you.

    Connection pooling uses the Java container to maintain the connection to the database. How the connection pooling is implemented is somewhat different from server to server.

    You will have to create a data source and register the driver in the container and tell the container how many connections to maintain. Then register the data source through JNDI.

    In your application code, you have to look up the resource through JNDI, and obtain a connection from the container as a data source. From that point on, it works just like you registered the database driver and created the connection yourself.

    I traced it as follows

    z=0 x=1 y=0
    z=1 x=2 y=0
    z=2 x=3 y=1(the && condition is true so x++ evaluated and x is now 4)
    z=3 x=5 y=2(here x++ excecuted and x is 6 now)
    z=4 x=7 y=3

    so o/p should be x=7 and y=3 right?
    but it is mentioned as x=6 and y=3

    At z=2, you say that "&& condition is true", but the y>2 condition actually returns false for another two iterations of the loop. The if's block does not execute until z=4.
    14 years ago
    I suppose to answer your question you really have to define what you mean by a


    If you mean a stand-alone Java application, then no. The JVM looks for a method public static void main(String[]) as an entry to the application. Failing to find that, it will throw an exception and terminate.

    However, there are several other types of applications that do not use the main() method. Web-applications and applets are a couple that come to mind. However, they have special JVMs that allow them to run. In the first case, web applications run in a Java container we commonly call a server. In the second case the application runs in a browser plug-in.
    14 years ago
    Unfortunately, JSP requires some form of Java container (server). Each user would have to have access to the container in order for it to work. In a case where the computer was notconnected to the internet, the local computer would have to have a container like Tomcat installed to interpret the JSP tags before the user could see the results.
    14 years ago
    Unfortunately, JSP requires some form of Java container (server). Each user would have to have access to the container in order for it to work. In a case where the computer was notconnected to the internet, the local computer would have to have a container like Tomcat installed to interpret the JSP tags before the user could see the results.
    14 years ago
    Many companies are getting away from IT certifications as a proof of capability.

    However, If you can successfully pass the certification exam, you should be able to convincingly answer technical interview questions.