Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting up my JDBC environment

 
Fred Hamilton
Ranch Hand
Posts: 684
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64702
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Fred Hamilton
Ranch Hand
Posts: 684
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 684
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic