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.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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.
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
In the above attached java file ( , the auto commit feature is set to false (line number 49). if you don't want that feature , just comment it.

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();
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.
RdichpallyAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.