|
|
-
MySQLjDBCDataModel with JNDI
Amrhal Lelasm 2012-04-22, 13:29
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.
+
Amrhal Lelasm 2012-04-22, 13:29
-
Re: MySQLjDBCDataModel with JNDI
Sean Owen 2012-04-22, 14:11
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 <[EMAIL PROTECTED]> 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.
+
Sean Owen 2012-04-22, 14:11
-
Re: MySQLjDBCDataModel with JNDI
Lance Norskog 2012-04-22, 22:17
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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
+
Lance Norskog 2012-04-22, 22:17
-
Re: MySQLjDBCDataModel with JNDI
Sean Owen 2012-04-22, 22:27
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 <[EMAIL PROTECTED]> wrote: > JNDI is the basic library for representing JDBC connection > specifications. You can use it from any program.
+
Sean Owen 2012-04-22, 22:27
-
Re: MySQLjDBCDataModel with JNDI
Lance Norskog 2012-04-23, 21:38
Ah! Apologies.
On Sun, Apr 22, 2012 at 3:27 PM, Sean Owen <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> wrote: >> JNDI is the basic library for representing JDBC connection >> specifications. You can use it from any program.
-- Lance Norskog [EMAIL PROTECTED]
+
Lance Norskog 2012-04-23, 21:38
|
|