File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes jdbc Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "jdbc" Watch "jdbc" New topic


kooskuntla reddy

Joined: May 22, 2007
Posts: 1
how get connection to database.
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3381

Use either of them

  • DriverManager - Class in java.sql package
  • DataSource - Interface in javax.sql package

  • Both of them have a method called getConnection(). DriverManager has it as a static method whereas DataSource's is an instance method. getConnection() gives you a java.sql.Connection object.

    Also make sure of the JDBC Driver Type as well. Depends on that you need to pass the Connection URL.

    You can go through these links

  • JDBC Tutorial from Sun
  • JDBC articles in Sun

  • HtH.
    [ May 23, 2007: Message edited by: Raghavan Muthu ]

    Everything has got its own deadline including one's EGO!
    [CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
    I agree. Here's the link:
    subject: jdbc
    It's not a secret anymore!