You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Amrhal Lelasm <ar...@hotmail.com> on 2012/04/22 15:29:57 UTC

MySQLjDBCDataModel with JNDI

Hi, 
I've been playing with Mahout for a while and I'm now trying to use a preference data from a database. So far I've been running Mahout using ant as a normal java application outside of any web container. My question is, if  I can use JNDI to connect to the database in this scenario?  From what I've read so far, it seems I should run my application inside a web container like tomcat to use JNDI. Is this right? 
Thanks. 		 	   		  

Re: MySQLjDBCDataModel with JNDI

Posted by Lance Norskog <go...@gmail.com>.
Ah! Apologies.

On Sun, Apr 22, 2012 at 3:27 PM, Sean Owen <sr...@gmail.com> wrote:
> No, JNDI is quite separate from JDBC. java.sql and javax.sql contain
> the JDBC APIs in Java; javax.naming is JNDI. JNDI is just a directory
> service and nothing to do with databases. It's a way to locate
> resources -- like a JDBC DataSource. J2EE containers usually use it to
> expose the resources that the container has configured. You don't have
> to use JNDI to use JDBC, but your container may expose JDBC resources
> through it. That's why JNDI is mentioned at all in Mahout.
>
> You can't use JNDI in any program. It's not part of J2SE, but part of
> J2EE. You would never use it unless you needed to -- like in writing a
> web app.
>
> On Sun, Apr 22, 2012 at 11:17 PM, Lance Norskog <go...@gmail.com> wrote:
>> JNDI is the basic library for representing JDBC connection
>> specifications. You can use it from any program.



-- 
Lance Norskog
goksron@gmail.com

Re: MySQLjDBCDataModel with JNDI

Posted by Sean Owen <sr...@gmail.com>.
No, JNDI is quite separate from JDBC. java.sql and javax.sql contain
the JDBC APIs in Java; javax.naming is JNDI. JNDI is just a directory
service and nothing to do with databases. It's a way to locate
resources -- like a JDBC DataSource. J2EE containers usually use it to
expose the resources that the container has configured. You don't have
to use JNDI to use JDBC, but your container may expose JDBC resources
through it. That's why JNDI is mentioned at all in Mahout.

You can't use JNDI in any program. It's not part of J2SE, but part of
J2EE. You would never use it unless you needed to -- like in writing a
web app.

On Sun, Apr 22, 2012 at 11:17 PM, Lance Norskog <go...@gmail.com> wrote:
> JNDI is the basic library for representing JDBC connection
> specifications. You can use it from any program.

Re: MySQLjDBCDataModel with JNDI

Posted by Lance Norskog <go...@gmail.com>.
JNDI is the basic library for representing JDBC connection
specifications. You can use it from any program.

On Sun, Apr 22, 2012 at 7:11 AM, Sean Owen <sr...@gmail.com> wrote:
> Nope, and I answered you on SO:
>
>
> JNDI is a technology that is not specific to Tomcat, no. It is a
> directory service, part of J2EE, and supported by most J2EE containers
> -- like Tomcat, but also JBoss, etc.
>
> I don't quite understand the question, since you would only use JNDI
> in the context of an app or web server like Tomcat. But you don't want
> to use Tomcat. So why do you want to use JNDI?
>
> Certainly you don't need JNDI to use Mahout. Just pass it a DataSource
> that you configured, rather than looked up.
>
>
> On Sun, Apr 22, 2012 at 2:29 PM, Amrhal Lelasm <ar...@hotmail.com> wrote:
>>
>> Hi,
>> I've been playing with Mahout for a while and I'm now trying to use a preference data from a database. So far I've been running Mahout using ant as a normal java application outside of any web container. My question is, if  I can use JNDI to connect to the database in this scenario?  From what I've read so far, it seems I should run my application inside a web container like tomcat to use JNDI. Is this right?
>> Thanks.



-- 
Lance Norskog
goksron@gmail.com

Re: MySQLjDBCDataModel with JNDI

Posted by Sean Owen <sr...@gmail.com>.
Nope, and I answered you on SO:


JNDI is a technology that is not specific to Tomcat, no. It is a
directory service, part of J2EE, and supported by most J2EE containers
-- like Tomcat, but also JBoss, etc.

I don't quite understand the question, since you would only use JNDI
in the context of an app or web server like Tomcat. But you don't want
to use Tomcat. So why do you want to use JNDI?

Certainly you don't need JNDI to use Mahout. Just pass it a DataSource
that you configured, rather than looked up.


On Sun, Apr 22, 2012 at 2:29 PM, Amrhal Lelasm <ar...@hotmail.com> wrote:
>
> Hi,
> I've been playing with Mahout for a while and I'm now trying to use a preference data from a database. So far I've been running Mahout using ant as a normal java application outside of any web container. My question is, if  I can use JNDI to connect to the database in this scenario?  From what I've read so far, it seems I should run my application inside a web container like tomcat to use JNDI. Is this right?
> Thanks.