JAVA STAND ALONE TEST

I want to test JDBC to connect to the database from some small standalone Java test. How do I do this and in what environment can I try.
java-jdbc.txt
RdichpallyAsked:
Who is Participating?
 
Suraj_MathewConnect With a Mentor Commented:
Attached is the sample program to connect to the Oracle database.
Inorder to execute this , you need to include a jar file named "ojdbc14.jar" in the classpath.  

This jar file can be easily downloaded from internet , free of cost.

JDBCVersion.java
0
 
mrcoffee365Commented:
You have to install java, compile the file, and run it.  You have to have an Oracle database -- do you have one?

If you want help, tell us what operating system you have, what dbms you want to use, and what you have done so far.
0
 
Suraj_MathewCommented:
In the above attached java file (JDBCVersion.java) , the auto commit feature is set to false (line number 49). if you don't want that feature , just comment it.

JUST FOR YOUR INFORMATION
Auto Commit feature will automatically commit the changes made by you to the database , so that everyone connected to that database can view the changes made by you.
When it is set to false , the changes made by you will be visible only in your database session , and not to outside world. And these can be marked commited  by the statement connection.commit();
0
 
Suraj_MathewCommented:
You can execute this program either from command prompt or from eclipse.

If you are executing it from Command prompt , then set the CLASSPATH as shown below and compile/execute the above java program.

set CLASSPATH=.;C:\XYZ\ojdbc14.jar;


If you are executing in Eclipse IDE , then set the  path of ojdbc14.jar in the build path.
0
 
RdichpallyAuthor Commented:
ok
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.