www.webdeveloper.com
Results 1 to 4 of 4

Thread: Database Connection

  1. #1
    Join Date
    Nov 2004
    Location
    London
    Posts
    6

    Database Connection

    Hello there

    I am new to java but I am gradually picking it up. I am currently having problems connecting to an Access database. I've tried everything I know but I'll have to admit, I'm getting nowhere. The Access database is local and I've created an ODBC called "toy" yet I can't get it going. This is the code I'm trying to use. Can anyone out there help?

    import java.sql.*;

    public class ConnectAccess{

    public static void main(String [] args) {

    (new ConnectAccess()).runSession();
    }

    public void runSession(){

    try{

    //get connection
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

    connection con = DriverManager.getConnection("jdbcdbc:toy");

    System.out.println("Connection Successfully...");

    }
    catch (Exception e){
    }
    con.close();
    }
    }

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,123
    first and foremost thing to do in this situation wil be to make sure that you have created a DSN name properly.If so then post you rerror that you are getting
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  3. #3
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    So what happens?

  4. #4
    Join Date
    Nov 2004
    Location
    Kuala Lumpur, Malaysia
    Posts
    3

    Have u install correctly the jdbc driver

    I have recently browse this page. hope it helps you

    http://stardeveloper.com/articles/di...3090201&page=4

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles