Originally posted by Bear Bibeault:
You can submit a static page containing your 3 fields, but you need to submit it to something. If you want it to be Java (as opposed to a CGI language like Perl), then a servlet is the answer.
The servlet can retrieve the three values, do whatever DB machinations that need to be done (or better yet delegate that task to UI-agnostic business objects), and then....
Well, that's where your explanation breaks down. In a web app, requests don;t return values (such as the boolean that you cited), they return responses. That is, the "next" web page.
So, your users are on a page with these three fields. They click the submit button and your DB magic happens. Then what? What do you want to happen at that point?
Originally posted by Tom Blough:
Todd,
Did you set up idxAnalyzerCustom as a user or system data source? If you use that form you need to configure an ODBC datasouce on your machine with that name. For MS Access you can use the alternative URL for the getConnection method that specifies the file/path to the .mdb file that I wrote about.
Java is also case sensitive. sun.jdbc.odbc.JdbcOdbcDriver is not the same as sun.jdbc.odbc.jdbcodbcdriver. The former is correct.
Tom
Originally posted by Tom Blough:
Todd,
One thing I should point out is all the "magic numbers" in columnNames.getString() methods. Those are documented in the Java API for DatabaseMetaData.getColumns().
Have fun,
Originally posted by Maximilian Stocker:
All right here we go...
Now a few notes. This program uses the Jtds driver. So if you want to use yours you need to make the appropriate changes including your class path.
The database I used is SQL Server although that doesn't matter... what is important is that I created a table called tblTest with three fields. An autoincrementing int field that is my primary key called id and two varchar fields called firstname and last name.
To compile this program all you need to do is
javac DBTest.java
To run the program as is you would do
java -classpath .;jtds-0.9.jar DBTest
In my case my jar is in the directory with the program but you can make the neccessary modifications. There are plenty of comments but essentially you will need to change the connection variables and if you use a different driver than change the class name and class path as needed.
"Todd J.",
There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.
In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.