RE: IIS + Tomcat 5.0 + NT authentication AUTH_USER

2004-01-08 Thread Hooper, Brian
See if request.getHeader("Authorization") gives you anything.  That is what I have 
been using with IIS and Tomcat 4.X.  The data is Base64 encoded, but I have some code 
to grab the username and password from that if you need it.

-Brian

-Original Message-
From: Jason Wilson [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 08, 2004 12:54 PM
To: [EMAIL PROTECTED]
Subject: IIS + Tomcat 5.0 + NT authentication AUTH_USER


Hi,
 
I'm using 
  Tomcat 5.0.16
  connector-jk-2.0.2-win32-iis
  IIS 5.0

Currently my application is running under IIS + ColdFusion(Jrun), but will be 
migrating to a IIS/Tomcat server.  Since this is an intranet application on an NT 
network, where it is a requirement to have the users not have to implicitly logon, I 
am using NT authentication with IIS.  In other words, for the virtual directory, I 
have set the Anonomous access off, and Integrated Windows Authenticated on. 

In the IIS + ColdFusion setup, my servlet does a 
request.getHeader("AUTH_USER"); and this returns the domain/userid of the person 
logged into the client machine.  Then I can verify the user is allowed to use the 
application.  All is well.

However, in the IIS + Tomcat setup,
getHeader("AUTH_USER") is returning null.  I have
tried other header keys and get null also.

Also, I am sure IIS is authenticating the user, since
I cannot get to the application using a browser that
doesn't support the windows authentication.

So, it appears, for some reason, the connector is not
setting the AUTH_USER header when it transfers to the
Tomcat container.

Does anyone know how I can fix this so it does, or if
there is anything I might be doing wrong.

Thanks in advance,
Jason


__
Do you Yahoo!?
Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes 
http://hotjobs.sweepstakes.yahoo.com/signingbonus

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


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



RE: Microsoft SQL Server validation query

2004-01-09 Thread Hooper, Brian
These queries all seem like an awful lot of unnecessary processing.  Here's what I use:

SELECT 1+1

-Original Message-
From: Antonio Fiol Bonnín [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 1:25 AM
To: Tomcat Users List
Subject: Re: Microsoft SQL Server validation query


For any database server I can think of:

CREATE TABLE validation ( dummy char(1) );
INSERT INTO validation VALUES ( 'X' ); -- and make sure you do this only 
once

And then use as a validation query:
SELECT * FROM validation;

Well. Yes. I am ashamed of reimplementing Oracle's "DUAL", but if you 
really want to know of a table that will always be there, provide it 
yourself.

And anyway, I mostly agree with Mike's statement about server-specific 
params in the config files: "Adding one more ... is not too much of a 
burden".

Only if you set the validation query from outside the config files, 
which is very unlikely, Mike's statement would not strictly apply IMHO.

Antonio Fiol

Derek Mahar wrote:

>Thank you to all of you for your quick replies.  It seems that the 
>connection pool validation query is not specific to any database server 
>implementation unless the query statement itself is server-specific 
>(that is, it refers to a special server system database, table, or 
>function).  I like the idea of querying the server for the date, but 
>I'm not sure that the date function is standard SQL and portable across 
>all server implementations.  Does anyone know otherwise?
>
>Derek
>
>-Original Message-
>From: Peter Lin [mailto:[EMAIL PROTECTED]
>Sent: January 8, 2004 10:35 AM
>To: Tomcat Users List
>Subject: RE: Microsoft SQL Server validation query
>
>
> 
>in the past I just select the date from sql server. unless you want to 
>test a specific table, but that has potential performance impact.
> 
>the safe simple query to see if sql server is alive is to just select 
>the date.
> 
>peter lin
>
>
>Allistair Crossley <[EMAIL PROTECTED]> wrote:
>I would not do that because that would return as many 1s as there are 
>rows in the table. Something like count(*) may not be the most 
>efficient but it returns just 1 row always. Also with using 1, you 
>cannot guarantee a row will come back.
>
>
>
>Allistair Crossley
>__
>
>Intranet Senior Developer
>New Media Group, QAS Ltd
>Telephone: 020 7819 5343
>__
>
>
>-Original Message-
>From: Michael Duffy [mailto:[EMAIL PROTECTED]
>Sent: 08 January 2004 15:25
>To: Tomcat Users List
>Subject: RE: Microsoft SQL Server validation query
>
>
>
>Or even "SELECT 1 FROM TABLE". No COUNT overhead, if
>any. - MOD
>
>
>--- Allistair Crossley
>wrote:
>  
>
>>i think you could use anything .. maybe
>>
>>SELECT COUNT(*) FROM table
>>
>>The dual table is an oracle dummy table and is quite
>>handy, but I think the validation query can just be
>>any old select statement that should return true a
>>result always.
>>
>>ADC
>>
>>-Original Message-
>>From: Derek Mahar [mailto:[EMAIL PROTECTED]
>>Sent: 08 January 2004 15:15
>>To: Tomcat Users List
>>Subject: Microsoft SQL Server validation query
>>
>>
>>Does anyone happen to know which validation query I
>>should use for
>>Microsoft SQL Server?
>>
>>Derek
>>
>>
>>
>>


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



Tomcat Deadlock

2004-01-09 Thread Hooper, Brian
I'm having a weird problem with Tomcat locking up.  I have a couple of
functions on my site that rely heavily on transactions.  To do a simple
load test, I picked the function that hits the database the most and
opened that same page in two different browser windows.  I hit the
submit button at roughly the same time, and waited.  It appeared that
both browser windows stalled.  I looked at the processes in SQL Server
(2000) and it said that all of the processes for the app were sleeping,
and the two being used were sitting on insert statements for the same
table (database deadlock?).  I let both browsers sit trying to load for
a lot longer than it should have taken for the page to finish, then just
closed the windows.  After that, the site was no longer accessible.  The
only way to get it working again was to restart the Tomcat service.

Looking at the various log files, the only entry that appears
interesting is the following from the site's log:
2004-01-09 10:43:18 StandardWrapper[/WIPT:action]: Waiting for 2
instance(s) to be deallocated

I'm using tomcat 4.1.27 with SQL Server 2000 on a Win2K box.  I've been
having similar problems off and on for the last couple of weeks and have
tried a number of different things to fix it.  I made sure I closed all
connections, statements, and result sets.  I put all of the close code
in a finally block.  Another quick question - if the browser is closed
in the middle of an operation, is the code in the finally block
executed?

Here is the JNDI data source definition from server.xml:

  
  
 
factoryorg.apache.commons.dbcp.BasicDataS
ourceFactory

 
driverClassNamecom.jnetdirect.jsql.JSQLDr
iver
 
urljdbc:JSQLConnect://:1433/WIPT
username
password

maxActive15
maxIdle15
minIdle2
maxWait1

validationQuerySELECT
1+1
testOnBorrowtrue
testOnReturntrue
testWhileIdletrue
 
timeBetweenEvictionRunsMillis180
testWhileIdletrue
 
numTestsPerEvictionRun3

 
removeAbandonedtrue
 
removeAbandonedTimeout300
logAbandonedtrue
  

Thanks!
-Brian

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



RE: Tomcat Deadlock

2004-01-09 Thread Hooper, Brian
te void initConnection(boolean transact) throws Exception {
try {
this.conn = this.ds.getConnection();
if (transact) {
this.conn.setAutoCommit(false);
 
this.conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
// Set the LOCK_TIMEOUT
this.stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
this.stmt.executeUpdate("SET LOCK_TIMEOUT " +
Globals.DB_LOCK_TIMEOUT + "; ");
// Commit the LOCK_TIMEOUT
//commit();
}
else {
this.conn.setAutoCommit(true);
 
this.conn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTE
D);
// Set the LOCK_TIMEOUT
this.stmt =
conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY);
this.stmt.executeUpdate("SET LOCK_TIMEOUT " +
Globals.DB_LOCK_TIMEOUT + "; ");
}
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception(e);
}
}

public ResultSet runSQL(String sqlstmt) throws Exception {
try {
return this.stmt.executeQuery(sqlstmt);
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception(e);
}
}

public int runUpdateSQL(String sqlstmt) throws Exception {
try {
return this.stmt.executeUpdate(sqlstmt);
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception(e);
}
}

public ResultSet runStoredProc(String sqlstmt) throws Exception {
try {
this.cstmt = this.conn.prepareCall(sqlstmt,
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
return this.cstmt.executeQuery();
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception(e);
}
}

public int runUpdateStoredProc(String sqlstmt) throws Exception {
try {
this.cstmt = this.conn.prepareCall(sqlstmt,
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
return this.cstmt.executeUpdate();
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception(e);
}
}

// Commit the database connection
public void commit() throws Exception {
try {
if (this.transaction) {
this.conn.commit();
}
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception(e);
}
}

// End the database connection
public void end() {
try {
if (this.transaction) {
this.conn.commit();
}
}
catch (Exception e) {}
finally {
cleanUpDatabase();
}
}

// Rollback the database connection
public void rollbackDB() {
try {
if (this.transaction) {
this.conn.rollback();
}
}
catch (Exception e) {}
finally {
cleanUpDatabase();
}
}

// Set the database objects to null.  Only done on object creation!!
private void nullObjects() {
this.ds = null;
this.conn = null;
this.stmt = null;
this.pstmt = null;
this.cstmt = null;
}

// Clean up database objects
private void cleanUpDatabase() {
if (this.stmt != null) {
try { this.stmt.close(); } catch (SQLException e) { ; }
this.stmt = null;
}
if (this.pstmt != null) {
try { this.pstmt.close(); } catch (SQLException e) { ; }
this.pstmt = null;
}
if (this.cstmt != null) {
try { this.cstmt.close(); } catch (SQLException e) { ; }
this.cstmt = null;
}
if (this.conn != null) {
try { this.conn.close(); } catch (SQLException e) { ; }
this.conn = null;
}
if (this.ds != null)
this.ds = null;
}

public void destroy() {
cleanUpDatabase();
this.dbName = null;
}
}

-Original Message-
From: Shapira, Yoav [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 11:23 AM
To: Tomcat Users List
Subject: RE: Tomcat Deadlock



Howdy,
Can you share your code that serves the page that locked up?

Yoav Shapira
Millennium ChemInformatics


>-Original Message-
>From: Hooper, Brian [mailto:[EMAIL PROTECTED]
>Sent: Friday, January 09, 2004 11:19 AM
>To: Tomcat Users List
>Subject: Tomcat Deadlock
>
>I'm having a weird problem with Tomcat locking up.  I have a couple of 
>functions on my site that rely heavily on transactions.  To do a simple

>load test, I picked the function that h

RE: Microsoft SQL Server validation query

2004-01-09 Thread Hooper, Brian
Oops, I didn't realize those types of queries don't fly on other databases.  Thanks 
for the tip.

-Original Message-
From: Antonio Fiol Bonnín [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 12:03 PM
To: Tomcat Users List
Subject: Re: Microsoft SQL Server validation query


Hooper, Brian wrote:

>These queries all seem like an awful lot of unnecessary processing.  
>Here's what I use:
>
>SELECT 1+1
>  
>

Indeed. If your server supports it, there is an even simpler one: 
"select 1" or "select 0".

But this is not correct SQL for an Oracle server. Equivalent Oracle 
syntax is "select 1 from dual".

But on other servers, "dual" does not exist by default. Well... you see 
what I mean...

Antonio

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



RE: Tomcat Deadlock

2004-01-09 Thread Hooper, Brian
I thought I was by defining the data source (using
org.apache.commons.dbcp.BasicDataSourceFactory) in my server.xml file
and using JNDI to access it?

-Original Message-
From: Steve Nelson [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 12:50 PM
To: 'Tomcat Users List'
Subject: RE: Tomcat Deadlock




First off, if you have the option you might try using a database pool
instead of using 1 connection for multiple threads (As in Tomcat).

At one company I worked for we had some problems with using 1
connection. Data would be read/written incorrectly. Results from one
query would be returned to another etc. Bad driver...probably, but it's
still a safer and better use of resources to let Tomcat give you a
connection from a pool and then release it back when you are done.

-Steve


-Original Message-----
From: Hooper, Brian [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 11:46 AM
To: Tomcat Users List
Subject: RE: Tomcat Deadlock


The code itself is pretty long.  Maybe it would be better if I explain
how I handle database connectivity (which I'm guessing has some flaws),
and I know I should be encapsulating my queries in EJB's, but for now I
just have a lot of inline SQL in my Actions.  I use a DatabaseManager
class (at the end of the e-mail) to connect to my database.  If an
action needs to connect, it makes a new DatabaseManager object.  It uses
the methods in the class, then at the end it calls a function to clean
up the connection, etc.  Here is the code for the database manager
class:

package WIPT;

import java.sql.*;
import javax.sql.*;
import java.util.*;
import java.lang.*;
import java.io.*;
import javax.naming.*;

public class DatabaseManager {

// Data Members

// Keep track of the current database in use for transactions
private String dbName;
// The data source
private DataSource ds;
// The connection
private Connection conn;
// The statement
private Statement stmt;
// The prepared statement
private PreparedStatement pstmt;
// The callable statement (for stored procedures)
private CallableStatement cstmt;
// If transactions are being used or not
private boolean transaction;

// Empty constructor
public DatabaseManager() throws Exception {
// Initialize the database objects to null initially
nullObjects();
// Initialize the database objects to their real values
try {
// Default the database to WIPT and not to use transactions
this.dbName = "wipt";
this.transaction = false;
initDataSource(this.dbName);
initConnection(this.transaction);
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception("Unable to initialize the WIPT
database");
}
}

// Overloaded constructor to allow the transaction level to be
specified
public DatabaseManager(boolean transact) throws Exception {
// Initialize the database objects to null initially
nullObjects();
// Initialize the database objects to their real values
try {
this.dbName = "wipt";
this.transaction = transact;
initDataSource(this.dbName);
initConnection(this.transaction);
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception("Unable to initialize the WIPT
database");
}
}

// Overloaded constructor to allow the database to be used ("wipt"
or "user")
public DatabaseManager(String dbName) throws Exception {
try {
if (dbName != null && dbName.toLowerCase().equals("user"))
this.dbName = "user";
else
this.dbName = "wipt";
this.transaction = false;
initDataSource(this.dbName);
initConnection(this.transaction);
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception("Unable to initialize the WIPT
database");
}
}

// Overloaded constructor to allow the transaction level to be
specified and the database to be used ("wipt" or "user")
public DatabaseManager(boolean transact, String dbName) throws
Exception {
try {
if (dbName != null && dbName.toLowerCase().equals("user"))
this.dbName = "user";
else
this.dbName = "wipt";
this.transaction = transact;
initDataSource(this.dbName);
initConnection(this.transaction);
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception("Unable to initialize the WIPT
database");
}
}

// Return the

RE: Tomcat Deadlock

2004-01-09 Thread Hooper, Brian
I followed the example for Tomcat 4.x when I set it up.  The only reason
I have a separate object is to hide some of the complexity.  I'm pretty
sure it's using a connection pool right now.

-Original Message-
From: Steve Nelson [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 1:25 PM
To: 'Tomcat Users List'
Subject: RE: Tomcat Deadlock



Take a look at this. 

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples
-how
to.html

Every time you load a page open the connection, then close it to release
it to the pool. That way each thread should get 1 connection.


-Original Message-
From: Hooper, Brian [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 12:20 PM
To: Tomcat Users List
Subject: RE: Tomcat Deadlock


I thought I was by defining the data source (using
org.apache.commons.dbcp.BasicDataSourceFactory) in my server.xml file
and using JNDI to access it?

-Original Message-
From: Steve Nelson [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 12:50 PM
To: 'Tomcat Users List'
Subject: RE: Tomcat Deadlock




First off, if you have the option you might try using a database pool
instead of using 1 connection for multiple threads (As in Tomcat).

At one company I worked for we had some problems with using 1
connection. Data would be read/written incorrectly. Results from one
query would be returned to another etc. Bad driver...probably, but it's
still a safer and better use of resources to let Tomcat give you a
connection from a pool and then release it back when you are done.

-Steve


-Original Message-
From: Hooper, Brian [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 11:46 AM
To: Tomcat Users List
Subject: RE: Tomcat Deadlock


The code itself is pretty long.  Maybe it would be better if I explain
how I handle database connectivity (which I'm guessing has some flaws),
and I know I should be encapsulating my queries in EJB's, but for now I
just have a lot of inline SQL in my Actions.  I use a DatabaseManager
class (at the end of the e-mail) to connect to my database.  If an
action needs to connect, it makes a new DatabaseManager object.  It uses
the methods in the class, then at the end it calls a function to clean
up the connection, etc.  Here is the code for the database manager
class:

package WIPT;

import java.sql.*;
import javax.sql.*;
import java.util.*;
import java.lang.*;
import java.io.*;
import javax.naming.*;

public class DatabaseManager {

// Data Members

// Keep track of the current database in use for transactions
private String dbName;
// The data source
private DataSource ds;
// The connection
private Connection conn;
// The statement
private Statement stmt;
// The prepared statement
private PreparedStatement pstmt;
// The callable statement (for stored procedures)
private CallableStatement cstmt;
// If transactions are being used or not
private boolean transaction;

// Empty constructor
public DatabaseManager() throws Exception {
// Initialize the database objects to null initially
nullObjects();
// Initialize the database objects to their real values
try {
// Default the database to WIPT and not to use transactions
this.dbName = "wipt";
this.transaction = false;
initDataSource(this.dbName);
initConnection(this.transaction);
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception("Unable to initialize the WIPT
database");
}
}

// Overloaded constructor to allow the transaction level to be
specified
public DatabaseManager(boolean transact) throws Exception {
// Initialize the database objects to null initially
nullObjects();
// Initialize the database objects to their real values
try {
this.dbName = "wipt";
this.transaction = transact;
initDataSource(this.dbName);
initConnection(this.transaction);
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception("Unable to initialize the WIPT
database");
}
}

// Overloaded constructor to allow the database to be used ("wipt"
or "user")
public DatabaseManager(String dbName) throws Exception {
try {
if (dbName != null && dbName.toLowerCase().equals("user"))
this.dbName = "user";
else
this.dbName = "wipt";
this.transaction = false;
initDataSource(this.dbName);
initConnection(this.transaction);
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception("Unable to initialize the WIPT
database")

RE: Tomcat Deadlock

2004-01-09 Thread Hooper, Brian
I do create a new instance, but each instance grabs a connection from
the pool instead of making a new connection.  I think this is ok.  Maybe
my problem is with SQL Server locks instead of anything on the tomcat
side.  It just seems like something on the tomcat side should timeout
instead of locking up the server.  If I assume that it's a deadlock in
SQL Server (and for some reason SQL Server isn't reporting it), can
anyone think of a reason why tomcat would not respond?  The connection
pool still has connections available.  It could be that tomcat isn't
really hanging.  I have a filter set up that checks to see if the user
is authenticated, so the database is hit before every page request.

-Original Message-
From: Steve Nelson [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 1:59 PM
To: 'Tomcat Users List'
Subject: RE: Tomcat Deadlock





Hrmm... Do you create a new instance of the DatabaseManager class during
each load of the page? 

For some strange, wacky reason I thought you were using it almost as a
singleton. If that's not the case then you probably are doing the right
thing with that, and I am just talkin fluff.


-----Original Message-
From: Hooper, Brian [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 12:50 PM
To: Tomcat Users List
Subject: RE: Tomcat Deadlock


I followed the example for Tomcat 4.x when I set it up.  The only reason
I have a separate object is to hide some of the complexity.  I'm pretty
sure it's using a connection pool right now.

-Original Message-
From: Steve Nelson [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 1:25 PM
To: 'Tomcat Users List'
Subject: RE: Tomcat Deadlock



Take a look at this. 

http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples
-how
to.html

Every time you load a page open the connection, then close it to release
it to the pool. That way each thread should get 1 connection.


-Original Message-
From: Hooper, Brian [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 12:20 PM
To: Tomcat Users List
Subject: RE: Tomcat Deadlock


I thought I was by defining the data source (using
org.apache.commons.dbcp.BasicDataSourceFactory) in my server.xml file
and using JNDI to access it?

-Original Message-
From: Steve Nelson [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 12:50 PM
To: 'Tomcat Users List'
Subject: RE: Tomcat Deadlock




First off, if you have the option you might try using a database pool
instead of using 1 connection for multiple threads (As in Tomcat).

At one company I worked for we had some problems with using 1
connection. Data would be read/written incorrectly. Results from one
query would be returned to another etc. Bad driver...probably, but it's
still a safer and better use of resources to let Tomcat give you a
connection from a pool and then release it back when you are done.

-Steve


-Original Message-
From: Hooper, Brian [mailto:[EMAIL PROTECTED]
Sent: Friday, January 09, 2004 11:46 AM
To: Tomcat Users List
Subject: RE: Tomcat Deadlock


The code itself is pretty long.  Maybe it would be better if I explain
how I handle database connectivity (which I'm guessing has some flaws),
and I know I should be encapsulating my queries in EJB's, but for now I
just have a lot of inline SQL in my Actions.  I use a DatabaseManager
class (at the end of the e-mail) to connect to my database.  If an
action needs to connect, it makes a new DatabaseManager object.  It uses
the methods in the class, then at the end it calls a function to clean
up the connection, etc.  Here is the code for the database manager
class:

package WIPT;

import java.sql.*;
import javax.sql.*;
import java.util.*;
import java.lang.*;
import java.io.*;
import javax.naming.*;

public class DatabaseManager {

// Data Members

// Keep track of the current database in use for transactions
private String dbName;
// The data source
private DataSource ds;
// The connection
private Connection conn;
// The statement
private Statement stmt;
// The prepared statement
private PreparedStatement pstmt;
// The callable statement (for stored procedures)
private CallableStatement cstmt;
// If transactions are being used or not
private boolean transaction;

// Empty constructor
public DatabaseManager() throws Exception {
// Initialize the database objects to null initially
nullObjects();
// Initialize the database objects to their real values
try {
// Default the database to WIPT and not to use transactions
this.dbName = "wipt";
this.transaction = false;
initDataSource(this.dbName);
initConnection(this.transaction);
}
catch (Exception e) {
cleanUpDatabase();
throw new Exception("Unable to i

RE: OT?:Can't include .js file on jsp page controlled by front co ntro ller servlet

2004-01-12 Thread Hooper, Brian
Or:

blah

-Original Message-
From: Mike Curwen [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 12, 2004 1:23 PM
To: 'Tomcat Users List'
Subject: RE: OT?:Can't include .js file on jsp page controlled by front
co ntro ller servlet


Also, if you're using an anchor tag that has "#" in it, then using
'onclick', change that to:

href=javascript:
 
The "#" will cause the page to reload, and because it's a JSP, you might
be invoking something you're not wanting to invoke. (like a login
check).
 
We had this exact problem when using mat kruse's calendar javascript
(because I think his examples use #, but for us it was causing
problems).

> -Original Message-
> From: Januski, Ken [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 12, 2004 11:43 AM
> To: Tomcat Users List
> Subject: RE: OT?:Can't include .js file on jsp page 
> controlled by front co ntro ller servlet
> 
> 
> I've changed javascript source from 'src ="http:..." ' to
> src="<%=request.getContextPath()%>/scripts/datetimepicker.js">
> . But I find that the requestDispather is still being called, 
> and then it can't find the js. file. What I don't understand 
> is why, when the calendar that calls the javascript is 
> clicked, that the file is not just included and the 
> javascript executed rather than the servlet calling requestDispatcher.
> 
> Thanks for any help. I realize that this is getting a bit off
> a specific TC topic. I've just been wrestling with it and 
> would like to figure it out.
> 
> Ken
> 
> -Original Message-
> From: Januski, Ken [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 12, 2004 12:25 PM
> To: Tomcat Users List
> Subject: RE: OT?:Can't include .js file on jsp page
> controlled by front co ntro ller servlet
> 
> 
> Thanks,
> 
> The .js file is a downloaded calendar, i.e. I didn't write it
> myself. I'm including it, per the instructions that came with 
> it, using src="http:/...". I believe I've tried including it 
> using a system file path and still had problems. But I'll 
> give it another try just to make sure.
> 
> I guess I should have added that I'm also a beginner with
> javascript and that might be part of the problem.
> 
> Ken
> 
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> Sent: Monday, January 12, 2004 12:07 PM
> To: Tomcat Users List
> Subject: Re: OT?:Can't include .js file on jsp page
> controlled by front contro ller servlet
> 
> 
> A JavaScript include is a purely HTML thing - it shouldnt be
> processed in 
> any way by the server.  You can do it by going:
> 
> 
> 
> cheers
> Pete
> 
> Kiss Technologies
> 
http://www.kisstechnologies.co.uk/

4, Percy Street
London
W1T 1DF

Phone numbers:

Phone 020 7692 9922
Fax 020 7692 9923




"Januski, Ken" <[EMAIL PROTECTED]>
12/01/2004 16:58
Please respond to "Tomcat Users List"
 
To: Tomcat Users List <[EMAIL PROTECTED]>
cc: 
Subject:OT?:Can't include .js file on jsp page
controlled 
by front contro ller servlet


I may be getting in over my head here as I'm really not all that
familiar with patterns. And I'm not sure that the pattern has anything
to do with problem. But I have a controller servlet through which all
web requests 
must
pass. It has worked fine as is. Until I tried to include a .js file on a

jsp
page. In that case it seems to either print it out to page, rather than
execute it, or it tries to use requestDispatcher portion of controller
servlet to forward/include it. Normally the requestDispatcher forwards
request to the requested page after it checks to see if user is logged
in. But now it seems to go into an infinite loop when forwarding. And  I
guess it's trying to use requestDispather.include because the .js
resource is included via a "src='http:...' " request. I know that this
is a very vague question but I wonder if anyone has any clues as to
where the problem 
might
lie or what I can start experimenting with.

email protected and scanned by AdvascanTM - keeping email useful - 
www.advascan.com





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


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



RE: HELP: Servlet File Download solution.

2004-01-14 Thread Hooper, Brian
This probably doesn't matter, but try this instead:

response.setHeader("Content-Disposition",
  "attachment;filename=\"" + myFileName + "\"");
// Removed the space in between "attachment;" and "filename"
response.setContentType("application/octet-stream");
// I don't think you need to specify the filename again

Using the above seems to work for me, but I'm not sure if a user with
IE5 has tried it.  What happens when you use it in IE5?  Error message?
Data output to the screen?  Empty file?

It might be a MIME problem also.

-Brian

-Original Message-
From: Rai Ou [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 13, 2004 9:45 PM
To: 'Tomcat Users List'
Subject: HELP: Servlet File Download solution.


I wrote a download servlet but I found it didn't run at IE5.x

IE6.x - OK
IE5.x - NG
NS - OK

My source is below. I want to know if there are better solutions or any
Common Libarary I can use.

response.setHeader("Content-Disposition",
  "attachment; filename=\"" + myFileName + "\"");
response.setContentType("application/octet-stream;
  name=\"" + myFileName + "\"");
String f = myFilePath;
PrintWriter out = response.getWriter();
BufferedReader in 
= new BufferedReader(new FileReader(f));
String line;
while ((line = in.readLine()) != null) {
   out.println(line);
}
in.close();

Thanks.
Rai



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


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



RE: What does this mean? ajp13.service() Error sending initial post -1 0 0

2004-01-20 Thread Hooper, Brian
Not sure about your problem, but I recently ran across this URL:
http://jspisapi.neurospeech.com/

Anyone have any experience with this product?

Coincidently I'm having some weird problems using 4.1.29, IIS 5, and JK2.  If a user 
goes to a jsp page, it takes a really long time initially (~10 seconds for a simple 
page).  They can click on other pages that pop up immediately, but if they wait for a 
while, the next page request takes a long time.  If I look at the NT event log there 
are a lot of application warnings from "Apache Jakarta Connector2".  I was going to 
ask the list about it but I wanted to see if TC5 fixes the problem.  Interestingly the 
problem only appeared on my production server, never on my dev server.

-Original Message-
From: Rasmus Munk [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 20, 2004 9:22 AM
To: 'Tomcat Users List'
Subject: RE: What does this mean? ajp13.service() Error sending initial post -1 0 0


Nothing  happens, but i guess that is because I have no mapping for the root! The 
strange thing about my error is this:

It happens only somtimes. It seems like I caused by the folowing conditions:

1. The size of the POST is something like 10k or bigger.
2. The last call to tomcat is more than 2 minutes old!!

I know it sounds incredible, but this is what I have come to to after several days of 
testing.

As I cannot make the connector work, does anyone know if it is possible to run tomcat 
in-process, thereby passing the requests from IIS using som sort of other technique 
than the HTTP redirecting?

-Rasmus

-Original Message-
From: Edson Alves Pereira [mailto:[EMAIL PROTECTED] 
Sent: 20. januar 2004 15:12
To: 'Tomcat Users List'
Subject: RE: What does this mean? ajp13.service() Error sending initial post -1 0 0

What happens if you type ( http://127.0.0.1/index.jsp ) in your browser?

> --
> De:   Rasmus Munk[SMTP:[EMAIL PROTECTED]
> Responder:Tomcat Users List
> Enviada:  terça-feira, 20 de janeiro de 2004 9:06
> Para: 'Tomcat Users List'
> Assunto:  What does this mean?  ajp13.service() Error sending initial
> post -1 0 0
> 
> Hi
>  
> I am running tomcat 4.1.29 on IIS 5.0 and j2k 2.0.2 (have also tried
> older
> versions)
>  
> Sometimes I get this error in the j2k.log:
>  
> [Tue Jan 20 13:03:18 2004] (error ) [jk_worker_ajp13.c (380)]
> ajp13.service() Error sending initial post -1 0 0
>  
> the log continues:
>  
> [Tue Jan 20 13:03:18 2004] (debug ) [jk_handler_response.c (155)]
> handler.response() Header[0] [Content-Encoding] = [gzip] [Tue Jan 20
> 13:03:18 2004] (debug ) [jk_handler_response.c (155)]
> handler.response() Header[1] [Content-Type] = 
> [text/xml;charset=ISO-8859-1] [Tue Jan 20 13:03:18 2004] (debug ) 
> [jk_handler_response.c (155)]
> handler.response() Header[2] [Content-Length] = [199] [Tue Jan 20 
> 13:03:18 2004] (debug ) [jk_handler_response.c (172)]
> handler.response(): status=200 headers=3 [Tue Jan 20 13:03:18 2004] 
> (debug ) [jk_service_iis.c (93)]  Into jk_ws_service_t::head [Tue Jan 
> 20 13:03:18 2004] (debug ) [jk_service_iis.c (227)]  Into 
> jk_ws_service_t::write [Tue Jan 20 13:03:18 2004] (debug ) 
> [jk_isapi_plugin.c (516)] HttpExtensionProc service() returned OK
>  
> But the request is not passed to Tomcat, and a response i never sent
> to the browser!!
>  
> Anya ideas?
>  
> Thanks,
>  
> Rasmus
> 


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


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



RE: tomcat webapp welcome file

2004-01-20 Thread Hooper, Brian
The easiest way to do this would probably be to use hidden html frames.
This might help:

http://insights.iwarp.com/advanced/hiddenframe.html

That way no matter where a user goes in your site, all they see in the
address bar is http://localhost.

-Original Message-
From: Denis [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 19, 2004 9:25 PM
To: [EMAIL PROTECTED]
Subject: tomcat webapp welcome file


Hi:
  I created a webapp as ROOT under tomcat 4.1.27, and set the welcome
file as index.jsp for the webapp. And I start the tomcat server and open
my IE go to localhost. In the IE address bar, it changes to
http://localhost/index.jsp. Is there a way to config the tomcat to let
it not display index.jsp and just display http://localhost?
  Thanks in advance.
 
 
- Denis

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



RE: What does this mean? ajp13.service() Error sending initial p ost -1 0 0

2004-01-20 Thread Hooper, Brian
I don't think so, unless for some reason Tomcat decides it needs to recompile them on 
its own (without anyone touching the files).

-Original Message-
From: Bodycombe, Andrew [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 20, 2004 11:39 AM
To: 'Tomcat Users List'
Subject: RE: What does this mean? ajp13.service() Error sending initial p ost -1 0 0


Could the 10 second delay be caused by tomcat recompiling your jsp?

-Original Message-----
From: Hooper, Brian [mailto:[EMAIL PROTECTED] 
Sent: 20 January 2004 16:16
To: Tomcat Users List
Subject: RE: What does this mean? ajp13.service() Error sending initial post -1 0 0


Not sure about your problem, but I recently ran across this URL: 
http://jspisapi.neurospeech.com/

Anyone have any experience with this product?

Coincidently I'm having some weird problems using 4.1.29, IIS 5, and JK2. If a user 
goes to a jsp page, it takes a really long time initially (~10 seconds for a simple 
page).  They can click on other pages that pop up immediately, but if they wait for a 
while, the next page request takes a long time.  If I look at the NT event log there 
are a lot of application warnings from "Apache Jakarta Connector2".  I was going to 
ask the list about it but I wanted to see if TC5 fixes the problem.  Interestingly the 
problem only appeared on my production server, never on my dev server.

-Original Message-
From: Rasmus Munk [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 20, 2004 9:22 AM
To: 'Tomcat Users List'
Subject: RE: What does this mean? ajp13.service() Error sending initial post -1 0 0


Nothing  happens, but i guess that is because I have no mapping for the root! The 
strange thing about my error is this:

It happens only somtimes. It seems like I caused by the folowing conditions:

1. The size of the POST is something like 10k or bigger.
2. The last call to tomcat is more than 2 minutes old!!

I know it sounds incredible, but this is what I have come to to after several days of 
testing.

As I cannot make the connector work, does anyone know if it is possible to run tomcat 
in-process, thereby passing the requests from IIS using som sort of other technique 
than the HTTP redirecting?

-Rasmus

-Original Message-
From: Edson Alves Pereira [mailto:[EMAIL PROTECTED] 
Sent: 20. januar 2004 15:12
To: 'Tomcat Users List'
Subject: RE: What does this mean? ajp13.service() Error sending initial post -1 0 0

What happens if you type ( http://127.0.0.1/index.jsp ) in your browser?

> --
> De:   Rasmus Munk[SMTP:[EMAIL PROTECTED]
> Responder:Tomcat Users List
> Enviada:  terça-feira, 20 de janeiro de 2004 9:06
> Para: 'Tomcat Users List'
> Assunto:  What does this mean?  ajp13.service() Error sending initial
> post -1 0 0
> 
> Hi
>  
> I am running tomcat 4.1.29 on IIS 5.0 and j2k 2.0.2 (have also tried 
> older
> versions)
>  
> Sometimes I get this error in the j2k.log:
>  
> [Tue Jan 20 13:03:18 2004] (error ) [jk_worker_ajp13.c (380)]
> ajp13.service() Error sending initial post -1 0 0
>  
> the log continues:
>  
> [Tue Jan 20 13:03:18 2004] (debug ) [jk_handler_response.c (155)]
> handler.response() Header[0] [Content-Encoding] = [gzip] [Tue Jan 20 
> 13:03:18 2004] (debug ) [jk_handler_response.c (155)]
> handler.response() Header[1] [Content-Type] =
> [text/xml;charset=ISO-8859-1] [Tue Jan 20 13:03:18 2004] (debug ) 
> [jk_handler_response.c (155)]
> handler.response() Header[2] [Content-Length] = [199] [Tue Jan 20 
> 13:03:18 2004] (debug ) [jk_handler_response.c (172)]
> handler.response(): status=200 headers=3 [Tue Jan 20 13:03:18 2004] 
> (debug ) [jk_service_iis.c (93)]  Into jk_ws_service_t::head [Tue Jan 
> 20 13:03:18 2004] (debug ) [jk_service_iis.c (227)]  Into 
> jk_ws_service_t::write [Tue Jan 20 13:03:18 2004] (debug ) 
> [jk_isapi_plugin.c (516)] HttpExtensionProc service() returned OK
>  
> But the request is not passed to Tomcat, and a response i never sent 
> to the browser!!
>  
> Anya ideas?
>  
> Thanks,
>  
> Rasmus
> 


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


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

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


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