The MS driver and/or database is really really really stupid in certain repects; it reports that error in way too many cases when the real problem is either bad SQL or a mismatch between the SQL and the table structure.
In your case, it's bad SQL, change \"Hello\" to 'Hello'.
Actually, now is the time to learn one of the most important things you need to know about JDBC and the number one beginner mistake - you should usually use a PreparedStatement instead of a Statement. The reasons are many and very very very substantial; performance, security, and ease of coding top the list. For example, Google for: JDBC "sql injection"
Here's how you should do it:
[ February 15, 2006: Message edited by: stu derby ]
Joined: Jan 11, 2006
Cool. The book I have is just getting to prepared statements.
Joined: Jan 11, 2006
Oddly enough, I'm getting an error that's saying that the JDBC-ODBC bridge does not support prepared statements =(
Stus advice on using PreparedStatement is a good one. Here's another one: Avoid the JDBC/ODBC bridge. It's slow, it's buggy, it doesn't support a number of JDBC features, and doesn't multi-thread well, if at all. Use a real driver (unless you're using Access, in which case I think there aren't any other drivers).
I am, in fact, using Access, but really only for learning purposes. All is not lost however, I'm downloading MS SQL Express Server 2005 and the 350 megabyte .NET Framework 2.0 SDK required to run it on right. *twiddles thumbs patiently*
I guess I could always just download MySQL. There's a type 4 JDBC for that right?
Joined: Dec 15, 2005
Originally posted by Brandon Tom: I guess I could always just download MySQL. There's a type 4 JDBC for that right?
Other good free choices for self education that I know of these days are:
Totaly free (as in beer): Postgres (some people swear it's better than mysql, but it doesn't have the broad user community) Derby (an Apache project; derived from an IBM donation) Hypersonic (HSQLDB)
Free (as in beer) with significant restrictions: Oracle (either any version, single user development only license, or the new free Express Edition (in public beta for Linux and Windows), it's multi-user, missing a number of uber-advanced features and has a 4GB size limit on the DB and other restrictions, but is also free for commercial or other use, with no support) http://www.oracle.com/technology/products/database/xe/index.html
They all have their own quirks: Oracle's got the biggest learning curve, Derby and