File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Wanted: Sample JDBC 4 with SQL Annotation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Wanted: Sample JDBC 4 with SQL Annotation" Watch "Wanted: Sample JDBC 4 with SQL Annotation" New topic
Author

Wanted: Sample JDBC 4 with SQL Annotation

Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 376
I'm trying to run the sample code in "A Tutorial Java 6 New Features" by Budi Kurniawan page 167. The code for the book is available at http://books.brainysoftware.com/download/jdk6Samples.zip. Chapter 8 is the database chapter.

Neither the java command line javac nor the java6 compiler used by eclipse can find the class java.sql.DataSet.

What do I have to do to make to compile the following code?

Better yet, does someone have some sample JDBC4 code that demonstrates using annotations for SQL queries (insert, delete, select, update etc...) that compiles and runs?

I did some google searching and found some JDBC4 tutorials, but the code fragments did not include the import statements!

I was told that the only low cost database that includes a JDBC4 driver is IBM's Apache Derby. Is this true?

Thanks,
Siegfried

package jdbcDemo;
import java.sql.Connection;
import java.sql.DataSet;
import java.sql.DriverManager;
import java.sql.SQLException;

public class QueryDemo {

}
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36508
    
  16
I have looked in the J2SE and J2EE APIs and there is no sign of a Dataset class. Please check carefully that it really is java.sql.DataSet you are looking for.
The Apache Derby database is usually included with Java 6 SDK downloads.
Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 376
Well, OK, how about an example that uses that new feature where you specify the SQL in an annotation? Can someone point me to a working example of that feature?

Thanks,
Siegfried
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Wanted: Sample JDBC 4 with SQL Annotation
 
Similar Threads
Question : Pure Java Databases
For true beginners?
Struts Design and Programming by Budi Kurniawan
Java 7: A Beginner's Tutorial": What not to use
How to update JTextField from child thread?