Hi Philippe,
I only want to use Jonas 2.0's db connection pooling at the moment. I set up
a DB properties file for connecting via a type 3 jdbc driver (JDataConnect)
for accessing an Access-ODBC datasource on a WinNT4.0 system from my linux
box:
#
---------------------------------------------------------------------------
# The contents of this file are subject to the JOnAS Public License Version
# 1.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License on the JOnAS web site.
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied.
# See the License for the specific terms governing rights and limitations
# under the License.
#
# The Original Code is JOnAS application server code released July 1999.
#
# The Initial Developer of the Original Code is Bull S.A.
# The Original Code and portions created by Bull S.A. are
# Copyright (C) 1999 Bull S.A. All Rights Reserved.
#
# Contributor(s): ______________________________________.
#
#
---------------------------------------------------------------------------
# $Id: LanDB.properties,v 1.2 2000/02/03 14:04:56 durieuph Exp $
#
---------------------------------------------------------------------------
datasource.name landb
datasource.url
jdbc:JDataConnect://hi230025.hi.bosch.de/LanDB
#datasource.classname JData1_2.sql.$Driver
datasource.classname JData2_0.sql.$Driver
datasource.username xxxx
datasource.password xxxx
# -------------------------------------------------------------
# JDBC Connection Pool Configuration
# -------------------------------------------------------------
# JDBC connection checking level.
# 0 = no special checking
# 1 = check physical connection is still open before reusing it
# 2 = try every connection before reusing it
jdbc.connchecklevel 1
# max age for jdbc connections
# nb of minutes a connection can be kept in the pool
jdbc.connmaxage 30
# max concurrent threads on same tx/connection
jdbc.connmaxthreads 3
# max wait time if more than connmaxthreads threads request conn
# value is in seconds
jdbc.connexcltimeout 30
# test statement
jdbc.connteststmt select * from dual
Using rmiregistry as directory service I use the following jndi.properties
file which is in the system classpath:
###################### JNDI configuration
# Please refer to the JNDI documentation for further details.
# You must adapt <hostname> and maybe the port number (1099 by default)
# depending on your configuration.
# If you use Jeremie only
#java.naming.factory.initial
org.objectweb.jeremie.libs.services.registry.jndi.JRMIInitialContextFactory
#java.naming.provider.url jrmi://hi02s504.hi.bosch.de
# if you use rmi only
java.naming.factory.initial
com.sun.jndi.rmi.registry.RegistryContextFactory
java.naming.provider.url rmi://
# In both cases
java.naming.factory.url.pkgs org.objectweb.jonas.naming
I included my db.properties in jonas.properties and started rmiregistry on
default port and then EJBServer. The server tells me about successfully
mapping my db on the specified connection string. So far so good. Then I try
to lookup the datasource with the following code:
javax.naming.Context con = null;
java.util.Properties props = new java.util.Properties();
javax.sql.DataSource ds=null;
props.put("java.naming.factory.initial",
"com.sun.jndi.rmi.registry.RegistryContextFactory");
props.put("java.naming.provider.url",
"rmi://hi02s504.hi.bosch.de:1099");
try{
con=new javax.naming.InitialContext(props);
}catch(Exception e){
System.err.println("Cannot get initial context for
JNDI: "+e);
}
try{
javax.naming.NamingEnumeration ne=con.list("");
while(ne.hasMoreElements()){
System.out.println(ne.nextElement());
}
javax.naming.Reference ref=(javax.naming.Reference
)con.lookup("landb");
System.out.println(ref.toString());
ds=(javax.sql.DataSource )con.lookup("landb");
}catch(Exception e){
System.err.println("Cannot lookup DataSource: "+e);
e.printStackTrace();
}
which gives me the following output:
jonas_Adm: java.lang.Object
jdbc_1: java.lang.Object
javax.transaction.UserTransaction: java.lang.Object
TMFactory: java.lang.Object
landb: java.lang.Object
Reference Class Name: org.objectweb.jonas.dbm.ConnectionManager
Type: datasource.name
Content: landb
Type: datasource.url
Content: jdbc:JDataConnect://hi230025.hi.bosch.de/LanDB
Type: datasource.classname
Content: JData2_0.sql.$Driver
Type: datasource.username
Content: xxxx
Type: datasource.password
Content: xxxx
Cannot lookup DataSource: java.lang.ClassCastException:
javax.naming.Reference
So, I can lookup my DataSource as a javax.naming.Reference but cannot look
it up as javax.sql.DataSource.
Why ?
Sincerely,
> Mit freundlichen Grüßen,
>
> Kai Hudalla
> ______________________________________________
> Robert Bosch GmbH Hildesheim, Abt. QI/LBS3
> Tel.: 05121/49-2139 Fax: 05121/49172139 (BCN 9024)
> mailto: [EMAIL PROTECTED]
______________________________________________
There are three kinds of people: those who can count
and those who can't !
> -----Ursprüngliche Nachricht-----
> Von: Philippe Coq [SMTP:[EMAIL PROTECTED]]
> Gesendet am: Montag, 22. Mai 2000 12:53
> An: Hudalla Kai (QI/LBS3-HI) *
> Cc: '[EMAIL PROTECTED]'
> Betreff: Re: AW: Problem with lookup of the
> "javax.transaction.UserTransaction"
>
> "Hudalla Kai (QI/LBS3-HI) *" wrote:
> >
> > Hi Santiago,
> >
> > I encounter a similar problem when looking up a DataSource that I
> configured
> > for Jonas. I am looking it up from client code directly, i.e. I did not
> > deploy any beans yet. I do get back a javax.naming.Reference object from
> the
> > lookup() method call exactly as you did. Have you solved this problem
> yet ?
> >
> > Sincerely,
> > > Mit freundlichen Grüßen,
> > >
> > > Kai Hudalla
>
> Can you be more precise about what you exactly do.
> In general if one cannot look up UserTransaction" or DataSource etc...
> it means that the environment is not set up as explained
> in the JOnAS documentation.
> Verify the CLASSPATH, verify that the jndi.properties is set up
> correctly and is in a correct location
> Best regards,
>
> --
> Philippe
>
> Philippe Coq Groupe Bulll/BullSoft/OpenMaster Phone: (33) 04 76 29
> 78
> 49
> Bull S.A - 1 rue de Provence - 38432 Echirolles Cedex France
> [EMAIL PROTECTED] http://www-frec.bull.com
> Download our EJBServer at http://www.bullsoft.com/ejb
> ----
> To unsubscribe, send email to [EMAIL PROTECTED] and
> include in the body of the message "unsubscribe jonas-users".
> For general help, send email to [EMAIL PROTECTED] and
> include in the body of the message "help".
----
To unsubscribe, send email to [EMAIL PROTECTED] and
include in the body of the message "unsubscribe jonas-users".
For general help, send email to [EMAIL PROTECTED] and
include in the body of the message "help".