Results 1 to 2 of 2

Thread: Setting the DSN

  1. #1
    tim's Avatar
    tim is offline Senior Member
    Join Date
    Dec 2007
    Rep Power

    Default Setting the DSN

    Hello everyone.

    I'm self-studying JDBC and in the books and tutorials it says that the DSN for a database system must be set on the operating system, Windows in my case. How can this be done by Java code? I don't think that the end user should be doing this technical work. :rolleyes:

    Thank you. :D
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

  2. #2
    jelly's Avatar
    jelly is offline Member
    Join Date
    Jan 2008
    Somerset, UK
    Rep Power


    Hi Tim, just in case you never found the answer to this. Strictly speaking you cannot set the DSN from Java but what you can do is make a JDBC connect without a DSN, usually referred to as a DSNless connection. In this case you specify from code the details that you would have put in th eDSN, e.g.

    Java Code:
    String connectionString =
    "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=C:/dbs/salaries.MDB";
    DBConn = DriverManager.getConnection(connectionString);
    Masses on the net under dsnless connections if you need more
    -- Hope that helps

Similar Threads

  1. JTextArea setting
    By newtojava7 in forum New To Java
    Replies: 1
    Last Post: 01-29-2008, 03:57 AM
  2. Help with setting up Java
    By itmasterw in forum New To Java
    Replies: 6
    Last Post: 01-19-2008, 12:04 AM
  3. Help with setting up please
    By BlitzA in forum New To Java
    Replies: 6
    Last Post: 12-29-2007, 01:54 PM
  4. Setting cookies in JSP
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 12-10-2007, 06:33 PM
  5. Setting currency
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-16-2007, 03:08 PM

Posting Permissions

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