This week's book giveaway is in the Design and Architecture forum.
We're giving away four copies of Communication Patterns: A Guide for Developers and Architects and have Jacqui Read on-line!
See this thread for details.

Martin Simons

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

Recent posts by Martin Simons

However, remember, that this is the IP Address of the proxy pr provider that the actual end user has to go through, and that may be located in a different country then the end user himself.
Investigate the commands sed and awk. There is, as a matter fo fact, a very good book about the two of them by O'Reilly.
17 years ago
Well, I think a little code might be in order.

Show us the code where the null pointer exception is occurring and someone may be able to help you. As it is now we can't.

I will take a stab in the dark, though, and lay a small wager on the possibilty that somewhere in your code you are catching and ignoring SQLExceptions which then, later, causes you to attempt to use a reference that hasn't been defined yet.
Check out finalize in Object. Don't depend on this method though, as there are numerous situations in which it will not be called.
17 years ago
getResourceAsStream loads a file from your classpath. If the name starts with a slant then it denotes a path starting from the "root" of the class hierarchy. If the name does not start with a slant, then it denotes a path starting from the loading class' package. So, if the file is not located on your classpath, but rather somewhere else, then getResourceAsStream is not going to be able to find it. And, given the effects your seeing, that is the case.
17 years ago
No, as Mr.Wong pointed out, the client side of your login would have to collect the info and pass it along. This has a lot of problems in a web environment as you would have to use something along the lines of an Applet or JavaScript to attempt to gather this information and there are many ways in which the user can disable this sort of access to their system (and most of them are, now adays, active per default). So you would need the user to actively "open" these security holes on their system, and I don't think this would be appreciated. It would also be, as I believe I mentioned before, easily spoofable which would, again, make the information unreliable. (Which everything gathered through a browser on a client through either an Applet or JavaScript is unreliable.)
17 years ago

Originally posted by ravinder kopparam:
Hi,
my suggetion is better keep DB related code in servlet. Because it will be executed everytime whenever page gets loaded. Getter connection every time it is bit heavy process and also it is not a good practice.



I need to ask, why is it better to put the DB initialization info in a servlet? You do not need to initialise the Driver every time a servlet is accessed. If you are not capable of using the Application/Web servers connection pooling, then you would be much better off putting the initialization code into a class that will be executed by a listener when the application starts, and then save the initialized driver (probably in a class with methods for creating connections and doing other DB related tasks) in the application context.
17 years ago
JSP
If you need to actually know which machine logged onto the system, then you should be using MAC Addresses and not IP Addresses. A MAC Address can only be changed through a hardware modification, whereas an IP Address can be changed at any time (and many times, at least through DHCP, is changed dynamically at boot). But in either case, you will need to modify your login system to pass this information along, you cannot receive it remotely. And then keep in mind, that this info could be spoofed if anyone attempts to access the system through something other than your login process.
17 years ago
Download the Driver from http://www.mysql.org/

Also, if you are using the provided line of code in a JSP, you are probably doing domething that is now discouraged in a JSP, and the operation should be moved to a Servlet, a Context asset (whether servlet or session depends on its purpose), a Bean, or a custom JSTL tag.
17 years ago
JSP
Can you show us where you define "clsname". Also, as the previous poster mentioned, you need to convert the "." characters to "/" characters, and add a leading "/" character.

Edit:

And another to remember that, that complicates all of this, are internal classes, anonymous and otherwise, that will appear with a "$" character in the name of the class file, so the class file name will not exactly match the name of the class, if it even has one. So if you run into a class that contains internal classes and you wish to "cycle through" these classes as well, you may wind up having some real fun attempting to paste together the name of the class file.

2nd Edit:

Also, I don't believe the problem you are having here is really one for the Advanced forum. But, if the moderators agree with me, this thread will probably be moved to the Intermediate forum anyway.
[ January 12, 2007: Message edited by: Martin Simons ]
[ January 12, 2007: Message edited by: Martin Simons ]
17 years ago
I really don't know why you would want to do this, but if you would post the snippet of code you use in attempting to load the class, we may be able to help you a little better.
17 years ago
It is very nearly impossible for a computer to have every single port in use. It is theoretically possible, but so impractical and improbable as to at least be considered, if not truely be, impossible.

I have the feeling that you are attempting to bind the same port twice. Whether this is because of a loop, multiple threads, or whatever, I don't know. But, I would say to take a close look at your code, and debug it, to find out why you are attempting to open the port twice.

It is probably only an honest mistake, but I can almost guarantee (about 99% sure) that this is what is happening.
Just as a note, this is essentially the same advice I gave to his cross-posted question on the Java Intermediate forum.

@OP Please don't cross post. It is not considered polite in forum communities.
Also, Statement is still a perfectly valid interface. In fact, if you have a set statement, that is not dependant on a lot of variables to create, does not use user input (which could introduce SQL injection attacks), and is not going to be run mulitple times in succession, then Statement is actually preferable to PreparedStatement.
17 years ago
You would be much better off by installing and using something like sudo which will allow you to do things like this (in a controlled and regulated manner) without using passwords. I am willing to bet that your script has read permissions for all others and I am certain that ashok loves it that everyone can read his password (if they know where to find the script).

You really should not be passwords and/or passphrases in scripts. Like I said use "sudo", or something similar. Google for and download it, if it is not already installed. If you are using some form of Linux, I can would bet that it already is installed.
17 years ago