Index of /guides/java/staf2x/ex/jdbc/coffee-break

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory  -  
[TXT]README.html2001-01-17 20:03 5.1K 
[DIR]query-applet/2000-05-18 23:24 -  
[DIR]rowset/2000-12-13 13:20 -  
[DIR]servlet/2000-12-13 12:57 -  
[DIR]simple-applet/2000-12-13 13:02 -  
[DIR]simple-query-applet/2000-12-13 13:00 -  
[DIR]simple/2000-12-13 13:15 -  

Java Tutorial CoffeeBreak Example

This directory contains working MySQL examples from Mydene Fisher's JDBC Basics Tutorial. (local PASSWORD protected copy). You can consult SUN's full Java tutorial at http://java.sun.com/docs/books/tutorial/ (even download it).


Example Files / Directories

Java Applications (Simple Connect /Drop /Create/Query)

Examples in the simple directory are Java Applications. You need to download them to YOUR site AND you need to install the MySQL JDBC Driver(s).
  simple/ConnectCoffeesTwz1.java: 
       Simple connection test with Twz1 Driver - old, not maintained example

  simple/ConnectCoffeesMM.java: 
       Simple connection test with MM Driver - revised 2/2000

  simple/CreateCoffeesTwz1.java: 
       Simple drop/create test with Twz1 Driver  - old, not maintained example

  simple/CreateCoffeesMM.java: 
       Simple drop/create test with MM Driver (warning username & password removed - revised 2/2000

  simple/InsertCoffees.java: 
         Simple insert test with MM Driver - revised 2/2000

  simple/InsertCoffeesOLD.java: 
         Simple insert test with MM Driver - wrongly imports MySQL Driver classes, works but needs type casting.

  simple/QueryCoffees.java: 
         Simple query test with MM Driver - revised 2/2000


  *.ORI: Originals from the Tutorial files

Applets

The example in the simple-applet directory is working, but see the README.html for security. This applet does a simple canned query.

The examples in the simple-query-applet directory implement a simple query /update text windows where you can type in SQL expressions and watch the result.

Servlets

An running example servlet is at http://tecfa.unige.ch/guides/java/staf2x/ex/servlet/CoffeeBreakServlet (and on other java servers at Tecfa maybe) and the source is at http://tecfa.unige.ch/guides/java/staf2x/ex/WEB-INF/classes/CoffeeBreakServlet.java It does more or less the same thing as the applet examples (however I wouldn't program it this way anymore ....)

Notes

Drivers

Currently (1/99) only mm and twz1 seem to be popular. Both drivers have been tested with some examples. Other examples only use the MM Driver. I chose to work with MM because it claims to be faster, the author distributes a jar archive, it's GPL, the API doc looks fancier. Well let's say it was more or less randomly done :)

Tecfa Users: Classes are in /local/java/classes/xxx..

See ALSO: SUN's java.sql API doc (local password protected). You get this page from your own JDK API doc.

No suitable driver error message

It took me few hours to get the examples going. What was particular bad was the following totally inappropriate SQLException message:
java CreateCoffeesMMBad
==> SQLException: No suitable driver
Message:   No suitable driver
SQLState:  08001
ErrorCode: 0

This is the result from a BAD URL and has IMHO nothing to do with the driver. 
      String url = "jdbc:mysql:tecfa2.unige.ch:3306/COFFEEBREAK";
instead of:
      String url = "jdbc:mysql://tecfa2.unige.ch:3306/COFFEEBREAK";

Disclaimer

I am a newbie Java/Mysql/JDCB/... programmer.


Goto: http://tecfa.unige.ch/guides/mysql/ * http://tecfa.unige.ch/guides/java/pointers.html
D.K.S.