Win a copy of Rust Web Development this week in the Other Languages forum!

Jason Allen

Greenhorn
+ Follow
since Jan 25, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jason Allen

Yes, they are on another machine totally...
20 years ago
Yes, they are logging on with IE 5.
20 years ago
I have written a class that store connection information for a user, such as UserID, Password, etc. This class is getting instanciated by my application at the point a user logs in. Everything works fine until another user logs in. Once this happens, the previous information is overwritten, as if using the same instance, instead of creating a new one. I am developing in JSP and am storing the class in the session variable.
Anyone have any thoughts on why this would happen or how to prevent it?
I am instanciating the class as follows:
db2Connect myConnection = new db2Connect();
I then do
session.setAttribute("connection", myConnection);
to store the connection object in my session.
I retrieve it using:
db2Connect myConnection = new db2Connect();
myConnection = (db2Connect) session.getAttribute("connection");
db2Connect is the class I wrote. The above is not copy/paste code, so ignore any syntax errors.
Thanks,
Jason.
20 years ago
Ok, has something changed with the == operator for strings in v1.3?
I was almost positive that I couldn't use strObj1 == strObj2 in v1.1.8 and have it evaluate correctly when the arguments were equal.
Now I try it in v1.3 and it seems to work...so I can just say
strObj1 != strObj2 with no problems.
Let me know if I have missed something.
Jason.
20 years ago
I'm having difficulty coming up with a good solution for comparing string values and avoiding the NullPointerException.
Here's what I'm trying to do with half-way decent looking code I'll give the psuedocode:
Compare two String values to determine if they are equal.
String oldvalue;
String newvalue;
if oldvalue == newvalue then update = false
What is a pretty way to write this in Java. Both oldvalue and newvalue can have null.
In VB, all I have to say is if oldvalue = newvalue then do whatever.
In Java, it seems as if it is comparing at the address level when you use ==. If I use oldvalue.compareTo(newvalue) I get NullPointerException. If I use oldvalue == newvalue i don't believe it is ever "equal" because it possibly comparing addresses... If I were checking for a particular constant, I could just do "Joe".equals(name). But either argument could be null in my case.
Any ideas would be appreciated,
Thanks,
Jason.
20 years ago
I have finally gotten this all to work, it was kind of a nightmare, but it is working. Here are the points to make sure of to get this to work.
1) TYPE_SCROLLABLE_SENSITIVE is not supported by DB2 drivers
2) TYPE_SCROLLABLE_INSENSITIVE is supported
3) Make sure you are on the latest Java version (I'm using v1.3)
4) DB2 by default doesn't enable support for JDBC 2.0, you MUST add this support via environment variables. There is a script that they supply called usejdbc2 (what a surprise) This script needs to be called from your profile or webserver profile depending on your environment.
5) You must use the correct DB2 lib files. The required file is libdb2jdbc.so There are two versions of this. One is located under DB2/lib, the correct one to use for JDBC 2.0 is found in DB2/java12
6) I couldn't find where to set the correct path to allow tomcat to find this file, so I created a symbolic link in the java130/jre directory
Good luck with anyone else having these troubles, hope this saves someone time in the future.
I was having the same problem, but have since got it to work. Could you supply a snippet of your code.
20 years ago
Thanks.
From my understanding, the DB2 jdbc driver does support scrollable recordsets, however, it doesn't support TYPE_SCROLL_SENSITIVE. I haven't been able to test this yet, but I should very shortly.
Thanks for your reply,
Jason.
Apache is an http server that serves html pages. In order to compile and serve jsp pages you must have a jsp engine. This is where Tomcat picks up. Tomcat is both an html server and jsp engine. If you're just starting with jsp and are just doing prototyping, I would recommend using Tomcat alone as both html and jsp server. If however you are planning to put something into production, I would recommend going with Apache as the html server and Tomcat as the jsp server. This interaction can be configured between Apache and Tomcat. Check out the User Guides for configuration.
Jason.
20 years ago
Apache is a free web server found at http://www.apache.org
You can use the free Apache Tomcat as the JSP engine found at:
http://jakarta.apache.org
You can download the java runtime/development environment at http://java.sun.com
You don't compile JSP, it is compiled at runtime by the JSP engine.
There are simularities between ASP and JSP, if you know ASP, you should pick up on JSP very quickly. The main difference is in syntax and the way you access databases. You'll find many objects that you recognize from ASP, such as session, request, response, etc.
Good luck,
Jason.
20 years ago
Is the file login.jsp the form where the user enters their userid? If so, I don't think the getParameter will return anything, because it is actually running before the user has input any value.
I have my login setup like this.
login.jsp - screen to capture login info, once they hit login button, I send them to menu.jsp
menu.jsp - screen to getParamater from login.jsp and validate the user info. if they are not validated, I send them back to login.jsp. If they are validated, it then store the info in a session variable using the session.setAttribute.
It should then be available until the session ends.
Good luck!
Jason.
20 years ago
Argh! Well I think I found my problem. After a little bit of research, I found that our RS/6000 had JDK v1.1.8 installed hence being on a version that I don't believe supported scrollable resultsets. I now have our system admins downloading and installing v1.3 and that will hopefully fix my problem.
Thanks,
Jason.
Is there a way to find out if the driver I am using for JDBC has scrollable support. Whenever I try to use first() previous() etc, I get a method not found in RecordSet class. The driver name I am using is libdb2.a and it is version 07.01.0000 I was thinking it supported JDBC 2.0 specs, but I'm not sure. Maybe I possibly have an old driver or something.
I'm instantiating the connection object using COM.ibm.db2.jdbc.app.DB2Driver
I'm running on RS/6000 w/AIX and DB2 7.1 EEE.
Any ideas?
Jason.
Not sure what I was doing before, but that code did work.
Thanks for all the input.
Jason.
20 years ago
Thanks for the response.
I'll give it a try again. I've been known to do stupid things in the past...maybe this was one of them
20 years ago