We help IT Professionals succeed at work.

Connect to Oracle DB

heng03
heng03 asked
on
259 Views
Last Modified: 2010-03-31
Hi

I want to connect to a Oracle Db.

Below is an example for connect to a MS Access.
Pls give sample code for connect to Oracle DB.

            try{
                  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");      
            }
            catch(ClassNotFoundException e)      
            {
                  System.out.println(e);
                  return;            // to exit program on exception
            }            
      }


            try
            {
                  //Can be improved by using connection pooling
                  Connection con=DriverManager.getConnection("jdbc:odbc:Highway");
                  Statement stmt = con.createStatement();
} catch(SQLException e)
            {
                  System.out.println("Encountered problem adding question. "+e);
            }


Thanks & Rgds
Heng03

Comment
Watch Question

CERTIFIED EXPERT
Distinguished Expert 2019
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.