The following is an example of the CLASSPATH statement used for a Windows application:
CLASSPATH =.;C:\Program Files\Microsoft SQL Server 2005 JDBC Driver\sqljdbc_1.0\enu\sqljdbc.jar
The following is an example of the CLASSPATH statement used for a Unix/Linux application:
CLASSPATH =.;/home/usr1/mssqlserver2005jdbc/Driver/sqljdbc_1.0/enu/sqljdbc.jar
Originally posted by Paul Sturrock:
To compile the application the MS SQL JDBC driver files need to be in your projects build path.
"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.
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.
Originally posted by Maximilian Stocker:
...
99% of the time you do not need the driver libraries for any JDBC driver to compile. The only exception is when you are doing something driver specific for example when dealing with an Oracle BLOB. But that is a rarity most always you should not need the driver to compile....
Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
Tom Blough<br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>Cum catapultae proscriptae erunt tum soli proscripti catapultas habebunt.<hr></blockquote>
and POOF! You're gone! But look, this tiny ad is still here:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
|