none
How to connect to Remote Access database using Windows Application? RRS feed

  • Question

  •  

    Hello,

     

    I was writing code for an authetication application. And i want to connect to a remote database on another computer (not server). I don't know what connection string I should use could somebody tell me the connection string i use?

     

    I wrote this, but it doesn't work for me

    [code]

    Const ConnectionString1 As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=000.000.0.0; Initial Catalog = 'C:\ApplicationDir\AppName\Database.mdb'; User Id = 'myusername'; Password = ''mypassword"

    [code]

     

    Note: sample ip address,username, password and database location used. Database location format is real.

     

    Can somebody help me with this, I would really appreciate the help

     

    Thanks

    Sunday, March 16, 2008 1:10 AM

Answers

  •  Cybertech_Owner wrote:

    And i want to connect to a remote database on another computer (not server). I don't know what connection string I should use could somebody tell me the connection string i use?

     

    I wrote this, but it doesn't work for me

    [code]

    Const ConnectionString1 As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=000.000.0.0; Initial Catalog = 'C:\ApplicationDir\AppName\Database.mdb'; User Id = 'myusername'; Password = ''mypassword"

    [code]

     

    Hi Cybertech,

     

    Please don't confuse Access database connection string with SQL Server database connection string.

    And, to connect to remote Access, you need to set share folder (e.g. AppName) on remote computer 000.000.0.0.

    Code Snippet
           Dim con As OleDb.OleDbConnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\000.000.0.0\AppName\Database.mdb;User Id= 'myusername';Password='mypassword';")

    Code Snippet
            Dim con As SqlClient.SqlConnection = New SqlClient.SqlConnection("Data Source=myServerAddress;Initial Catalog=myDataBase;User Id='myUsername';Password='myPassword';")

    1. http://www.connectionstrings.com/?carrier=access   Connection Strings to Access


    OLE DB, OleDbConnection (.NET)   

    Standard security
    Provider=Microsoft.Jet.OLEDB.4.0;Data Source= RemotePath\mydatabase.mdb;User Id=admin;Password=;

    ODBC   

    Standard Security

    Driver={Microsoft Access Driver (*.mdb)};Dbq=RemotePath\mydatabase.mdb;Uid=Admin;Pwd=;

     

    2. http://www.connectionstrings.com/?carrier=sqlserver2005  Connection Strings to SQL Server 2005

    SqlConnection (.NET)

    Standard Security

    Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

     

    SQL Native Client ODBC Driver

    Standard security

    Driver={SQL Native Client};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

     

    Other references:

    Connection Strings to Access 2007
    http://www.connectionstrings.com/?carrier=access2007 

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1292835&SiteID=1
    How to connect remote access database from VB.net

     

    Regards,
    Martin

    Tuesday, March 18, 2008 6:29 AM