Re: Help using JDBC realm with MySQL

2002-04-26 Thread Fabrizio Giudici

I had the same problem in Windows 2000 and InnoDB tables, the 
relaxautocommit worked but
the parameter has a leading UNDERSCORE:

jdbc:mysql://localhost/peopleshare?_relaxAutocommit=trueetc...

I found it by code inspection.

I don't know if it works under Linux, I'm still fighting with access 
control problems, but it should work.

Shawn A. Wilson wrote:

Well, I tried adding the relaxAutocommit=true parameter but I still get 
the same message. Arg... this is not making any sense. Do my tables need 
to be of a specific type? I created them without any options so they 
should be MyISAM.

-shawn

http://www.shawn-wilson.com

On Thu, 11 Apr 2002, Dennis Doubleday wrote:

Add the following parameter to your connection URL: relaxAutocommit=true

So it should look like:

jdbc:mysql://localhost/peopleshare?relaxAutocommit=trueuser=hiddenpass
word=hidden

-Original Message-
From: Shawn A. Wilson [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, April 11, 2002 2:33 PM
To: Tomcat Users List
Subject: Re: Help using JDBC realm with MySQL


Does nobody know a solution to get around this problem? I 
have received no 
replies and I desparately need to know how to get around the Cannot 
disable AUTO_COMMIT error with JDBC realms and MySQL.


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]





-- 
Fabrizio Giudici, Ph.D. - Senior Consultant
Java(TM) Architect, Mentor, Senior Writer
email  [EMAIL PROTECTED]
mobile +39 3481506941 - fax +39 (0)2700510536
Member of ADI (Italian Ph.D. Association) 





RE: Tyrex Tomcat

2002-02-13 Thread Fabrizio Giudici

I posted a response about this topic a couple of weeks ago. You must
go to tyrex, download the sources, get the ots.jar package and put it
into %TOMCAT_HOME%/common/lib. There's a small dependence in tyrex
upon CORBA classes, ant ots.jar contains the required files.

Hi.

--
Fabrizio Giudici, Ph.D. - Senior Consultant
Java(TM) Architect, Mentor, Senior Writer
email  [EMAIL PROTECTED]
mobile +39 348 1506941 - fax +39 02 700510536
Member of ADI (Italian Ph.D. Association)

 -Original Message-
 From: Mark Muffett [mailto:[EMAIL PROTECTED]]
 Sent: martedì 12 febbraio 2002 14.12
 To: [EMAIL PROTECTED]
 Subject: Tyrex  Tomcat


 I want to use the JNDI facilties for DataSources.  I have Tomcat 4.0.1 and
 I'm using tyrex-0.9.7.jar (which comes with Tomcat).

 I can't get it to work.  It compiles, but when I run the page and
 try to get
 a database connection, it gives the error:

 java.lang.NoClassDefFoundError: org/omg/CosTransactions/Inactive
  at
 tyrex.server.TransactionServer.createTransactionDomain(Transaction
 Server.jav
 a:200)
  at
 tyrex.server.TransactionServer.getTransactionDomain(TransactionSer
 ver.java:1
 83)
  at tyrex.tm.Tyrex.(Tyrex.java:77)
  at tyrex.tm.ResourceManager.run(ResourceManager.java:118)
  at java.security.AccessController.doPrivileged(Native Method)
  at tyrex.tm.ResourceManager.enlistResource(ResourceManager.java:91)
  at tyrex.jdbc.EnlistedConnection.enlist(EnlistedConnection.java:241)
  at tyrex.jdbc.EnlistedConnection.(EnlistedConnection.java:129)
  at tyrex.jdbc.ServerDataSource.getConnection(ServerDataSource.java:258)
  at tyrex.jdbc.ServerDataSource.getConnection(ServerDataSource.java:223)
  at AccessLog.doGet(AccessLog.java:190)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  

 Have I made a stupid error? or should I use a different version
 of Tyrex, or
 Tomcat, or should I try to find omg.jar (which I have searched
 for, but can
 find only on the Orbix site).

 Thanks for any help

 Mark


 --
 To unsubscribe:   mailto:[EMAIL PROTECTED]
 For additional commands: mailto:[EMAIL PROTECTED]
 Troubles with the list: mailto:[EMAIL PROTECTED]





--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




Tyrex transactions: a workaround

2002-02-02 Thread Fabrizio Giudici

Hi.

After some investigations about tyrex problems with
transactions and messing up with tyrex and catalina
sources I was able to analyze the problem (actually
two different bugs) and to find a quick and dirty workaround.


THE PROBLEM 1
=

Tyrex defines, among others, two kinds of DataSources:

- tyrex.jdbc.xa.EnabledDataSource
  is not aware of pooling and it does not register
  its connections with the transaction manager
- tyrex.jdbc.ServerDataSource
  is aware of pooling and registers its connections
  with the transaction manager

Guess what, it happens that tomcat 4 is giving us
the FORMER DataSource, so transactions are not working
(and pooling neither).

The factory for Tyrex datasources is
org.apache.naming.factory.TyrexDataSourceFactory
which lives in %CATALINA_HOME%/lib/naming-factory.jar.

The logics inside the factory create a
tyrex.jdbc.ServerDataSource only if the resource class
type is explicitly set to tyrex.jdbc.ServerDataSource.

It appears that the problem should be solved by properly
setting the 'type' attribute of Resource in server.xml:

Resource name=jdbc/adi auth=Container
type=tyrex.jdbc.ServerDataSource/

Unfortunately this does not work, and I believe this is a
tomcat bug (in facts, try to set 'type' to I.DO.NOT.EXIST
and you'll discover that catalina doesn't notice it).
The Resource gets always bound in JNDI with type
javax.sql.DataSource.

I haven't checked the bug archive yet to find if this is
a known bug; in the meantime I found a workaround that
works. I consider it a quick-and-dirty fix to help us
working with our applications until apache staff fixes the
problem.


THE WORKAROUND
==

Unfortunately we have to patch catalina :-(
Download catalina sources (I worked with 4.0.2-b2 but it
works well also with 4.0.1) and edit
\src\share\org\apache\naming\factory\TyrexDataSourceFactory:


 214 if (ref.getClassName().equals
 215 (tyrex.jdbc.ServerDataSource)) {
 216
 217 ServerDataSource sds =
 218 new
ServerDataSource((javax.sql.XADataSource) ds);
 219
 220 currentRefAddr = ref.get(DESCRIPTION);
 221 if (currentRefAddr != null)
 222 sds.setDescription
 223
(currentRefAddr.getContent().toString());
 224
 225 return sds;
 226
 227 }
 228
 229 return ds;

REMOVE LINES 214,215 and 227, 228, 229 so that the ServerDataSource is
always created.

To compile the code, if you don't want to do a complete build of
catalina, do the following:


1. get the %CATALINA_HOME%\server\lib\catalina.jar
2. compile TyrexDataSourceFactory.java including catalina.jar, servlet.jar
   and jdbc2_0-stdext.jar in the classpath
3. replace the TyrexDataSourceFactory.class in catalina.jar with the
   compiled one.


THE PROBLEM 2
=

A this point, you will find that every transaction operation
fails with catalina complaining about a org.omb.corba.XXX
missing class. The problem is that tyrex depends on a couple
of corba classes (even if you don't use them working locally).
To solve this, you must download tyrex distribution from
tyrex.exolab.org, find ots.jar and add it into
%CATALINA_HOME%\common\lib. At this point I was succesful in
having my transaction works!!!

Summing up, the bugs are:

  1. the type attribute for Resource does not work
  2. apache should include ots.jar with its distribution

Neither is a tyrex bug.

PS. There is a third, small problem that you can live with.
tyrex-0.9.7.0 misses a message resource file, so you will find
a complaining warning (and in case of problems you won't get
the correct diagnostic). If you want to fix it, download tyrex
sources from exolab, and add to the .jar the file
tyrex\utils\resources\message.properties. I sent an email to
the tyrex mailing list a couple of weeks ago, asking them if
it possible to quickly release a 0.9.7.1 with the missing file
added... but I got no reply.


If you manage in following my instructions and the thing
works for you, please let me know (to confirm my analisys).
If my analisys gets confirmed, I will post a message to the
tomcat-dev m.l. (and/or register a bug with the damn bug tracking
thing if I understand how to use it :-)


--
Fabrizio Giudici, Ph.D. - Senior Consultant
Java(TM) Architect, Mentor, Senior Writer
email  [EMAIL PROTECTED]
mobile +39 348 1506941 - fax +39 02 700510536
Member of ADI (Italian Ph.D. Association)


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Tyrex transactions: a workaround

2002-02-02 Thread Fabrizio Giudici

 Unfortunately this does not work, and I believe this is a
 tomcat bug (in facts, try to set 'type' to I.DO.NOT.EXIST
 and you'll discover that catalina doesn't notice it).
 The Resource gets always bound in JNDI with type
 javax.sql.DataSource.

Remy make me understand that this is not a bug in the way
I described it. My problem was that I had declared the resource
twice, both in server.xml and web.xml; in the latter I used
javax.sql.DataSource and it overrode the former.

Nevertheless, removing the entry from web.xml and using
tyrex.jdbc.ServerDataSource doesn't work, so it seems that 
the workaround is still needed. I will try again tomorrow.

--
Fabrizio Giudici, Ph.D. - Senior Consultant
Java(TM) Architect, Mentor, Senior Writer
email  [EMAIL PROTECTED]
mobile +39 348 1506941 - fax +39 02 700510536 
Member of ADI (Italian Ph.D. Association)


--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]




RE: Tyrex transactions: a workaround

2002-02-02 Thread Fabrizio Giudici

 Nevertheless, removing the entry from web.xml and using
 tyrex.jdbc.ServerDataSource doesn't work, so it seems that
 the workaround is still needed. I will try again tomorrow.

Thanks to Remy, I've finally discovered that we don't need to
patch catalina for tyrex transaction to work. Finally, both
with 4.0.1 and 4.0.2-b2, you just need to configure your JDBC
resources as follows (excerpt from server.xml):

 Context path=/newadi docBase=webapps debug=0 privileged=false
   Resource name=jdbc/adi auth=Container
type=tyrex.jdbc.ServerDataSource/
   ResourceParams name=jdbc/adi
 parameter
   namefactory/name
   valueorg.apache.naming.factory.TyrexDataSourceFactory/value
 /parameter
 parameter
   nameuser/name
   valuesystem/value
 /parameter
 parameter
   namepassword/name
   valuemanager/value
 /parameter
 parameter
   namedriverClassName/name
   valueoracle.lite.poljdbc.POLJDBCDriver/value
 /parameter
 parameter
   namedriverName/name
   valuejdbc:polite:adi/value
 /parameter
   /ResourceParams
/Context

The important things are:

  1. the attribute type=tyrex.jdbc.ServerDataSource for the Resource
  2. the 'factory' parameter set for ResourceParams to
 org.apache.naming.factory.TyrexDataSourceFactory

I remind you that you will still need to put ots.jar from
tyrex sources into %CATALINA_HOME%/common/lib, and that
tyrex-0.9.7.0 will complain about a missing message.properties
file (but it will work).

That's all.

--
Fabrizio Giudici, Ph.D. - Senior Consultant
Java(TM) Architect, Mentor, Senior Writer
email  [EMAIL PROTECTED]
mobile +39 348 1506941 - fax +39 02 700510536
Member of ADI (Italian Ph.D. Association)



--
To unsubscribe:   mailto:[EMAIL PROTECTED]
For additional commands: mailto:[EMAIL PROTECTED]
Troubles with the list: mailto:[EMAIL PROTECTED]