How to make Tomcat serve text documents with non-Latin1 characters in their names?

2002-08-29 Thread ahmet dalli

Hi all,

I need to have Tomcat serve text documents whose names
include characters of the ISO-8859-9 charset. 

When i put such a text document(ending with .txt) in a
directory and browse the directory contents with
Tomcat, the document is displayed but after i click
the link to browse that document, Tomcat complains
that the requested resource is not available.

How can i work around this?

Any suggestion/help is greatly appreciated...

Baris...

__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: Tomcat Realms with Digested Passwords -Urgent- ( A little longish...)

2002-08-28 Thread ahmet dalli

Thanks to those who were kind to share their
suggestions/comments. 

The problem was a subtle, but an important one : in
server.xml == roleNameCol=role_name 
but in database there is no column called role_name,
accidentally column's name is user_role!

Baris...


--- Rick Fincher [EMAIL PROTECTED] wrote:
 Hi Baris,
 
 I tried:
 java -classpath
 CATALINA_HOME/server/lib/catalina.jar
 org.apache.catalina.realm.RealmBase -a MD5 aksu
 
 And got:
 aksu:394e654ca65973f232653fb0008c603d
 
 So that seems to be working correctly.  You may want
 to try changing
 auth-methodBASIC/auth-method, to
 auth-methodDIGEST/auth-method.  Since the
 browser is getting the
 password you want it to be digested before it goes
 out on the net for
 security unless you are using SSL.  Then it gets
 encrypted anyway and
 digesting just protects your passwords from
 observation on the server side.
 This might require you to turn off digest in the
 realm.
 
 You can also increase the debug level in the realm
 and see what the log
 files say.
 
 Hope this helps,
 
 Rick
 
 
 
 - Original Message -
 From: ahmet dalli [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, August 27, 2002 3:14 AM
 Subject: Tomcat Realms with Digested Passwords
 -Urgent- ( A little
 longish...)
 
 
  Hi all,
 
  I am trying to use JDBCRealm to store user login
  information in an oracle database. I am working on
 a
  Windows2000 machine, using jdk1.4, and
 Tomcat4.0.4.
 
  In server.xml, i have this configuration:
  ^^
  Realm
  className=org.apache.catalina.realm.JDBCRealm
debug=99
driverName=oracle.jdbc.driver.OracleDriver
 

connectionURL=jdbc:oracle:thin:usr/pass@host:1521:ORCL
userTable=users userNameCol=user_name
userCredCol=user_pass
 userRoleTable=user_roles
roleNameCol=role_name digest=MD5 /
  ^^
 
  In an Oracle8i database, i have a table called
 users
  which has two columns named user_name and
  user_pass ; and yet another one called
  user_roles with to columns named user_name and
  user_role.
 
  When i store user passwords in cleartext,
 everything
  works fine.
 
  I want to store passwords in a digested form. So,
 i
  have used the following code to store a user_name
 :
  baris, user_pass : aksu and user_role : director.
 
  ^^^
  import org.apache.catalina.realm.RealmBase;
  import java.io.*;
  import java.sql.*;
 
  public class DigestDene {
public static void main(String[] args) {
 try {
  String username = args[0];
  String password = args[1];
  String role = args[2];
  String digested =
  RealmBase.Digest(password, MD5);
   //Here, code that connects to the database
/* .. */
  stmt.executeUpdate(insert into users
 values(' +
   username + ', ' + digested + '));
  stmt.executeUpdate(insert into user_roles
 values
 (' + username + ', ' + role + '));
 }
 catch(Exception ex) {}
 }
  }
  
  Then, i have inserted my user's info from the
  command-line with :
  ^^
  java DigestDene baris aksu director
  ^^^
  After this, I have these values in the database :
  (in table users)
   USER_NAMEUSER_PASS
  --- 
  baris394e654ca65973f232653fb0008c603d
 
  (in table user_roles)
  USER_NAME   USER_ROLE
  --- -
  baris   director
 
  Lastly, in web.xml i have these lines :
  ^^^
  security-constraint
  web-resource-collection
   web-resource-nameProtected Basla Servlet
   /web-resource-name
   url-pattern/servlet/IlkGirisServlet
   /url-pattern
  /web-resource-collection
  auth-constraint
   role-namedirector/role-name
  /auth-constraint
  user-data-constraint
  
 transport-guaranteeNONE/transport-guarantee
/user-data-constraint
   /security-constraint
   login-config
auth-methodBASIC/auth-method
/login-config
  ^
  When i try to acces my protected resource, i am
  presented with the classic login screen for BASIC
  authentication, and after i type baris for
 username
  and aksu for password, Tomcat doesn't simply let
 me
  in.
 
  Any suggestions or comments will be greatly
  appreciated.
 
  Baris.
 
 
 
 --
 To unsubscribe, e-mail:  
 mailto:[EMAIL PROTECTED]
 For additional commands, e-mail:
 mailto:[EMAIL PROTECTED]
 


__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Tomcat Realms with Digested Passwords -Urgent- ( A little longish...)

2002-08-27 Thread ahmet dalli

Hi all,

I am trying to use JDBCRealm to store user login
information in an oracle database. I am working on a
Windows2000 machine, using jdk1.4, and Tomcat4.0.4.

In server.xml, i have this configuration: 
^^
Realm 
className=org.apache.catalina.realm.JDBCRealm
  debug=99
  driverName=oracle.jdbc.driver.OracleDriver 
connectionURL=jdbc:oracle:thin:usr/pass@host:1521:ORCL
  userTable=users userNameCol=user_name
  userCredCol=user_pass userRoleTable=user_roles
  roleNameCol=role_name digest=MD5 /
^^

In an Oracle8i database, i have a table called users
which has two columns named user_name and
user_pass ; and yet another one called 
user_roles with to columns named user_name and
user_role. 

When i store user passwords in cleartext, everything
works fine.

I want to store passwords in a digested form. So, i
have used the following code to store a user_name :
baris, user_pass : aksu and user_role : director.

^^^
import org.apache.catalina.realm.RealmBase;
import java.io.*;
import java.sql.*;

public class DigestDene {
  public static void main(String[] args) {
   try {
String username = args[0];
String password = args[1];
String role = args[2];
String digested = 
RealmBase.Digest(password, MD5);
 //Here, code that connects to the database
  /* .. */
stmt.executeUpdate(insert into users values(' +
 username + ', ' + digested + '));
stmt.executeUpdate(insert into user_roles values
   (' + username + ', ' + role + '));
   }
   catch(Exception ex) {}
   }
} 

Then, i have inserted my user's info from the
command-line with :
^^
java DigestDene baris aksu director
^^^
After this, I have these values in the database :
(in table users)
 USER_NAMEUSER_PASS
--- 
baris394e654ca65973f232653fb0008c603d

(in table user_roles)
USER_NAME   USER_ROLE
--- -
baris   director

Lastly, in web.xml i have these lines :
^^^
security-constraint
web-resource-collection
 web-resource-nameProtected Basla Servlet
 /web-resource-name
 url-pattern/servlet/IlkGirisServlet
 /url-pattern
/web-resource-collection
auth-constraint
 role-namedirector/role-name
/auth-constraint
user-data-constraint
 transport-guaranteeNONE/transport-guarantee
  /user-data-constraint
 /security-constraint
 login-config
  auth-methodBASIC/auth-method
  /login-config
^
When i try to acces my protected resource, i am
presented with the classic login screen for BASIC
authentication, and after i type baris for username
and aksu for password, Tomcat doesn't simply let me
in.

Any suggestions or comments will be greatly
appreciated. 

Baris.

__
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Tomcat4.04+Oracle8i(8.1.7)+JDBC/OCI HOWTO(some hints...)

2002-07-05 Thread ahmet dalli

Hi all,

Here is what i learned from two days trying to access
an Oracle8i database using OCI driver.

1)In order to use OCI driver, you should have an
Oracle client installed. Suppose you have installed
Oracle8i(8.1.7) client from cd, and now you go to
otn(otn.oracle.com) and download the suitable JDBC/OCI
driver(Oracle8i 8.1.7.1 JDBC/OCI Driver) and after
renaming the classes12.zip file as classes12.jar
for Tomcat, you put it into somewhere so that
CLASSPATH references it, or directly into
%JAVA_HOME%\jre\lib\ext.

You are sure that you have the ocijdbc8.dll is in
your PATH(possibly in %ORAHOME%\bin) and you have also
confirmed that it could be loaded by a simple test
program using System.loadLibrary(ocijdbc8);.
You have a very simple test servlet that has tese
critical lines:
^^
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
conn =
DriverManager.getConnection(jdbc:oracle:oci8:@database,username,password);
^^
where database is of the form host:port:SID

Now you try to access the URL
http://localhost/servlet/OracleOCIServlet (or
localhost:8080... if you use Tomcat without Apache)
and what you get is a 


ServletException with a root cause of
java.lang.UnsatisfiedLinkError:get_env_handle.


You confirm that your simple program works with the
thin driver, you apply to Oracle metalink to no
avail...and you are stuck!!! 

First, this UnsatisfiedLinkError :  ...indicates that
you have a mismatch between your JDBC classes file and
your Oracle client version. The giveaway here is the
message stating that a needed library file cannot be
found. For example, you may be using a classes12.zip
file from Oracle Version 8.1.6 with a Version 8.1.5
Oracle client. The classeXXXs.zip file and Oracle
client software versions must match.(Java Programming
with Oracle JDBC, from O'reilly).

Second, give up the driver you have downloded from
otn, go to the directory %ORAHOME%\jdbc\lib and use
the classes12.zip file there

This will rescue you from this UnsatisfiedLinkError.

2)You have so far changed the classes12.zip file from
otn with the one that came with your client
installation, and now you get this error:

^^
ORA-06401 NETCMN: invalid driver designator


First, Oracle documentation says :
Cause: The login (connect) string contains an invalid
driver designator.
Action: Correct the string and re-submit.

Second, change the database(of the form
host:port:SID) with this one:

^^
(description=(address=(host=myhost)(protocol=tcp)(port=1521))(connect_data=(sid=orcl)))
^^

Now, if everything else is pure, you must be accessing
Oracle8i.

I hope these hints can help somebody struggling with
Tomcat/Oracle couple via OCI driver...

Baris


__
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Connection to 8.1.7 Database Fails With JDBC/OCI8 Driver: UnsatisfiedLinkError

2002-07-04 Thread ahmet dalli

Hi,

I tried to connect to an Oracle8i(8.1.7.0.0) database
from a servlet using OCI Driver(8.1.7.1 for JDK 1.2).
A ServletException was thrown with a root cause of
java.lang.UnsatisfiedLinkError: get_env_handle. 

The same program runs without an error using thin
driver. I have Oracle8i client installed and i have
the ocijdbc8.dll in my PATH environment variable.
classes12.zip(renamed as classes12.jar for Tomcat) is
in %JAVA_HOME%\jre\lib\ext. Database server is up
and running, i have confirmed that ocijdbc8.dll could
be loaded by a test program using
System.loadLibrary(ocijdbc8);. 

My platform : Windows2000 version5.0(Service Pack 2),
Oracle8i Client; Apache2.0.39 Web Server, Tomcat4.0.4
Servlet/JSP Container, J2SDK1.4.0, Oracle8i 8.1.7.1
JDBC/OCI Driver

Here is the code snippet that throws an exception
while trying to get a connection: 
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
conn =
DriverManager.getConnection(jdbc:oracle:oci8:@my_database,username,password);

I know that this version of OCI driver is for use with
JDK1.2, but what i try to do is a simple connect not
requiring any JDK1.4 features. So does this may be the
source of problem?

As far as i know, Oracle9i 9.2.0.1 JDBC/OCI Driver
supports jdk1.4. So, in order to be able to use
jdk1.4; I have to install Oracle9i Client for use
with OCI driver, I have to download Oracle9.2.01
JDBC/OCI driver with the necessary dll's, right?

What's more important is that; Will i be able to
connect to a Oracle8i(8.1.7) database?

Any suggestion/help will be appreciated


__
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]