Results 1 to 7 of 7

Thread: DSN for Jet Database

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Dec 1999
    Location
    San Francisco
    Posts
    16
    Hi,
    I'm using Access 2000. I want to use a DSN name to open the database. The provider I'm using is "Microsoft.Jet.OLEDB.4.0". I'm not sure whether I can give a DSN with this provider. Can anyone please let me know if it is possible to use DSN for "Microsoft.Jet.OLEDB.4.0" and if yes, how do I do it???
    Thanks in advance.

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    There are 2 ways to do it.

    First, you can create a DSN in the Control Panel (ODBC applet) and then using that DSN to connect:

    Code:
    Dim cn As New ADODB.Connection
    
    cn.Open "DSN=MyDSN"
    Where MyDSN is a DSN you've created.

    Or you can use DNSless connection:
    Code:
    Dim cn As New ADODB.Connection
    
    cn.Provider = "Microsoft.Jet.OLEDB.4.0"
    cn.Open "C:\MyDB.mdb", "admin", ""
    Assuming that C:\MyDB.mdb is your database.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Dec 1999
    Location
    San Francisco
    Posts
    16
    I want to use a DSN to connect to the database, but if I give the provide as "Microsoft.Jet.OLEDB.4.0" and use a DSN it gives me an error. How can I use a DSN with this provider????? This is the connection I'm using, but it gives ma an error when I run it....

    Cnn.Provider = "Microsoft.Jet.OLEDB.4.0"
    Cnnstring = "DSN=MyData"
    Cnn.Open Cnnstring

    Edited by Pinky on 03-17-2000 at 04:49 PM

  4. #4
    Addicted Member
    Join Date
    Jan 2000
    Location
    Oshkosh, WI
    Posts
    163
    What is the error you are getting ?

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Dec 1999
    Location
    San Francisco
    Posts
    16
    I'm getting Run-time error '-2147467259(800004005)': Could not find the file(.mdb)

  6. #6
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Did you physically create the DSN in the control panel???
    If yes, then check the path to the database you specified.
    If no, then you would have to create the DSN first.
    Also, if you have DSN, then you don't have to specify the Provider, DSN will take care of that (using the Microsoft Access Driver).

  7. #7
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    I don't think that DSNs can be used with Access 2000 databases -- I've tried using a DSN with DAO 3.6 and Jet 4.0 providers and I get UNRECOGNIZED DATABASE FORMAT....MS Support says to create the DSN using the new driver versions, but I don't see where I get that option, even though I have Access 2000 installed....

Posting Permissions

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



Click Here to Expand Forum to Full Width