Re: [Winstone-devel] JDBC and JDNI
Status: Beta
Brought to you by:
rickknowles
From: Matt S. <mat...@gm...> - 2009-01-14 00:40:44
|
Rick- That's the interesting bit. It doesn't work because it doesn't know about the drivers. When I call DriverManager.getDrivers() ( http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DriverManager.html#getDrivers()) without using the JNDI arguments, I get nothing. When I explicitly add com.mysql.jdbc.Driver via the JNDI arguments, getDrivers() indeed returns the mysql.jdbc.Driver, and I can make a connection. So, to be able to see the mysql Driver at all, I need to use those flags, but since I don't need to have a shared connection pool and consequently don't have a meaningful URL to provide, it throws an exception when trying to contact the nonsense URL. The odd part is that the "mysql-connector-java-5.1.6-bin.jar" file is indeed included in the commonLibFolder, so I don't see why it wouldn't load the driver. Thanks a bunch, Matt On Tue, Jan 13, 2009 at 4:35 PM, Rick Knowles <ri...@kn...> wrote: > Glad you like it. Always nice to hear of a good experience. > > I think the reason for the error message is that you might have confused > the need for JDBC access with the need for a JDBC connection pool managed by > the container. You shouldn't need the jndi parameters you mentioned if you > access the database with DriverManager.getConnection(). The JNDI stuff is > only if you want Winstone to maintain a pool of JDBC connecions for you, and > make those available via JNDI. It sounds like that's not what you want, so I > recommend removing all the JNDI args from winstone's startup command line. > It should work fine without them. > > HTH, > > Rick > > Matt Spitz wrote: > >> Hey! >> >> First off, I love Winstone. It's an awesome product. Thanks for >> everything you do. I've got a question, though, about JDBC and such. My >> goal is to be able to load MySQL connections via jdbc. (eg >> jdbc:mysql://mysqlserver/mydb ) >> >> I discovered that I couldn't load JDBC drivers in my Winstone program >> until I used the JDBC options. >> >> So now, I've got >> java -jar winstone-0.9.10.jar ... >> --useJNDI=true >> --jndi.resource.jdbc/connPool=javax.sql.DataSource >> --jndi.param.jdbc/connPool.driverClassName=com.mysql.jdbc.Driver >> >> And that's fine. Now I can use >> DriverManager.getConnection("jdbc:mysql://mysqlserver/mydb") and it starts >> the connections just fine. >> >> My question is why you require <http://winstone.sourceforge.net/#jndi>a >> url to be specified to JNDI to use Winstone. Shouldn't I be able to specify >> my connections (and usernames and passwords) in my Java code? >> >> The reason I ask is that I get a "No JDBC URL supplied" exception when I >> start Winstone, which isn't harmful at all (besides some fluff in my >> logfiles), but I'd like to get rid of it. >> >> Thanks again for an awesome awesome alternative to the otherwise bloaty >> and difficult-to-configure Tomcat. I really dig it. >> >> -Matt Spitz >> ------------------------------------------------------------------------ >> >> >> ------------------------------------------------------------------------------ >> This SF.net email is sponsored by: >> SourcForge Community >> SourceForge wants to tell your story. >> http://p.sf.net/sfu/sf-spreadtheword >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Winstone-devel mailing list >> Win...@li... >> https://lists.sourceforge.net/lists/listinfo/winstone-devel >> >> > |