aspose file tools*
The moose likes JDBC and the fly likes Setting up my JDBC environment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Setting up my JDBC environment" Watch "Setting up my JDBC environment" New topic
Author

Setting up my JDBC environment

Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
Greetings, I want to make sure I have the right pieces to get started with JDBC.

I have jdk1.6.0_14 on my machine, it's all set up fine.
I Also have mySQL server Community Edition up and running.

The following page http://java.sun.com/docs/books/tutorial/jdbc/basics/gettingstarted.html strongly suggests I use the JDBC driver that comes with NetBeans, but I'd really like to avoid NetBeans on my old pIII clunker, so it is not clear to me if I need an alternative.

Somewhere along the way, not sure how, I picked up a file mysql-connector-java-5.1.7.zip, which has a readme file which starts...

MySQL Connector/J @MYSQL_CJ_VERSION@ (formerly MM.MySQL)
Sun Microsystem's JDBC Driver for MySQL
Copyright 2003-2008 MySQL AB, 2008 Sun Microsystems

So can I assume that this is the only additional piece besides the JDK and mySQL server that I need?

Thanks much.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

Assuming that there's a jar file in the zip that contains the JDBC driver, you'll need to put that jar file in the execution classpath.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
Bear Bibeault wrote:Assuming that there's a jar file in the zip that contains the JDBC driver, you'll need to put that jar file in the execution classpath.


Thanks for the heads up. Yes indeed there is a .jar file that figures prominently, and the installation instructions confirm what you have written about classpath. The package also contains 10MB of source code and a 340kb readme file which in the finest Sun tradition makes my eyes glaze over, as their documentation does presuppose a certain level of knowledge on the part of the user. Anyways, for now I'm just gonna setup the .jar file as instructed and go on the assumption that all that source code is for an alternate installation. And then hit the Tutorial. I guess I'll find out soon enough whether just dealing with the jar file and the classpath is sufficient.

Fred Hamilton
Ranch Hand

Joined: May 13, 2009
Posts: 679
OK, that was easy enough, all is fine and I have my database connectivity from java. Having cut my teeth dealing with DOS environment variables on Win3.1 boxes, I was somewhat surprised to see a path variable (CLASSPATH) contain a file reference and not just the directory the file was in, but I suppose it makes sense considering that it is the .jar file that contains the class, and not the directory that contains the class.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting up my JDBC environment