Hi,

(I am not a jndi expert, so some of the things I say ought to work might
not.  If I say they won't, I'm pretty sure they won't)

There are DataSources and DataSources.  Some DataSources simply hand out
jdbc1.0 connections, just like calling DriverManager.getConnection, except
you can put the configuration info into the datasource bound in jndi.  My
understanding (possibly wrong) is that when you look one of these up, jndi
starts up a DataSource in the vm of the looking up process.  I believe for
example Borland's InterClient does this. 

The DataSources in JBoss and implied (as ConnectionFactory's) by the jca
spec are a bit more complicated: they are a facade that hands out temporary
handles to actual db connections which are pooled and have their
transactions managed elsewhere.  (IMHO reusing the Connection interface for
these is bogus, the transaction control methods shouldn't be there, or at
least use the cci LocalTransaction interface).  Since Connections usually
aren't serializable, and I would hope they wouldn't be, in order to get a
connection from one of these facade DataSources, you'd have to start up all
the pooling and transaction management machinery in your process's vm in
order to use the connection.  If you want that much infrastructure running,
I think you should be configuring it yourself so you know what you're
getting.

In fact jca resource adapters do provide an "unmanaged" mode, which is
expected to provide by default trivial (no) connection pooling.  You might
possibly be able to adapt the jbosscx module to deploy a resource adapter
(such as a jbosspool wrapped jdbc driver) into your standalone client. 
However, why would you want to do this? If you aren't using the
architecture you get with an ejb framework, why are you bothering with
ejb's in the first place?

david jencks
On 2001.07.06 19:53:05 -0400 Frank Marx wrote:
> 
> Sure I can access a DB from a standalone client using JDBC.
> The question was why I cannot access a JNDI to access a Datasource there
> ?
> I mean what is the reason, as far as I know JNDI is a basic service and
> is
> not limited to EJB.
> 
> When you look up a home interface of a EJB you can do this from a
> standalone
> client why should this not work
> with datasources, I mean at least find the datasource.
> 
> 
> Is it not possible to create a namespace under java: or java:comp and put
> the datasource there
> and look it up ?
> 
> Maybe the problem is that the beans are using per default the namespace
> java:comp/env and the standalone
> client not.
> 
> Frank
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Burkhard
> Vogel
> Sent: Friday, July 06, 2001 4:16 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [JBoss-user] Datasource Lookup from a standalone client
> 
> 
> Let's put it simple:
> You can't do it, forget it, stop trying, use beans or servlets for DB
> access!!!
> Burkhard
> ----- Original Message -----
> From: "Frank Marx" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, July 07, 2001 12:01 AM
> Subject: RE: [JBoss-user] Datasource Lookup from a standalone client
> 
> 
> > HI,
> >
> > so where has this Datasource to be bound that I can access it from a
> stand
> > alone JAVA Client ?
> >
> > As far a I understand a datasource (which beans can access) would be
> bound
> > to:
> >
> > java:comp/env/jdbc/DSource
> >
> > so how does this have to look like that a stand alone JAVA  Client can
> > access this Datasource ??
> >
> > Thanks,
> >
> > Frank Marx
> >
> >
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of
> > [EMAIL PROTECTED]
> > Sent: Friday, July 06, 2001 2:09 PM
> > To: [EMAIL PROTECTED]
> > Cc: [EMAIL PROTECTED];
> > [EMAIL PROTECTED]
> > Subject: Re: [JBoss-user] Datasource Lookup from a standalone client
> >
> >
> >
> > You are reading the spec incorrectly. You can only access things from
> > remote clients that are present in the Global jndi namespace (to get a
> view
> > of the namespace, use the jndiView mbean through http://localhost:8082
> -
> or
> > whatever port you have it set on).
> >
> > You don't want to access the DataSource from a remote client - that
> would
> > require the Connection object to be Serializable
> >
> > Alex
> >
> >
> >
> > |--------+-------------------------------------->
> > |        |          "gsekar ejb"                |
> > |        |          <[EMAIL PROTECTED]>      |
> > |        |          Sent by:                    |
> > |        |          [EMAIL PROTECTED]|
> > |        |          eforge.net                  |
> > |        |                                      |
> > |        |                                      |
> > |        |          07/06/01 03:44 PM           |
> > |        |          Please respond to jboss-user|
> > |        |                                      |
> > |--------+-------------------------------------->
> >
> >
> >---------------------------------------------------------------------------
> > --------------------------------|
> >   |
> > |
> >   |       To:     [EMAIL PROTECTED]
> > |
> >   |       cc:
> > |
> >   |       Subject:     [JBoss-user] Datasource Lookup from a standalone
> > client                                |
> >
> >
> >---------------------------------------------------------------------------
> > --------------------------------|
> >
> >
> >
> >
> > Version : JBoss-2.2.2
> >
> > I have defined a JDBC DataSource xxxx_pool and i can see that it is
> > successfully bound as java:/xxxx_pool.
> > [xxxx_pool] Starting
> > [xxxx_pool] XA Connection pool xxxx_pool bound to java:/xxxx_pool
> > [xxxx_pool] Started
> >
> > I have no problem accessing this datasource from within a Session Bean
> > using
> > Context ctx = new InitialContext();
> > DataSource ds = ctx.lookup("java:/xxxx_pool");
> >
> > But when I try to access this datasource from a standalone java client,
> I
> > am able to access the Context in the app server correctly and I am able
> to
> > list the bound objects ( This tells me that my jndi.properties is at
> the
> > right place and my client is able to connect to the App Server). But
> When
> I
> > do the  lookup for DataSource, I get a NamingException with xxxx_pool
> not
> > bound. From my understanding of the j2ee spec, I should be able to do
> this
> > lookup. IS this a bug or am I not understanding the spec correctly.
> Also
> > the Context.list doesnt list any of the datasources. It lists only the
> > bounf EJB objects.
> >
> > Thanks
> >
> > Sekar
> >
> > P.S. I have dont the same type of client look up in 2 other commercial
> App
> > Servers.
> >
> >
> >
> >
> > Get 250 color business cards for FREE!
> > http://businesscards.lycos.com/vp/fastpath/
> >
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/jboss-user
> >
> >
> >
> >
> >
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/jboss-user
> >
> > _______________________________________________
> > JBoss-user mailing list
> > [EMAIL PROTECTED]
> > http://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
> 
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/jboss-user
> 


_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to