Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Hybrid View

  1. #1
    Join Date
    Mar 2005
    Location
    Ontario, Canada
    Posts
    1,750

    Question Is it possible to connect to a remote Access database using C++?

    I'm working on a project which requires me to connect to a remote Access database on a server, using C++ (not MFC). I've written some code to connect to a LOCAL Access database file on my own machine and everything works fine. I can't seem to figure out how to get ODBC to talk to a remote Access database though (ie located at www.myurl.com\myDatabase.mdb). Can anyone suggest what I might try to get this to work?

    To make the local Access database connection I used the function called SQLDriverConnect.

    I tried modifying the connection string to include the keyword SERVER=www.myurl.com but for some reason I just get this error message:
    IM006:1:0:[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
    01S00:3:8:[Microsoft][ODBC Microsoft Access Driver]Invalid connection string attribute SERVER

    It looks to me like I can't use SERVER with the SQLDriverConnect function?

    Any help would be greatly appreciated, thanks.
    C++, 3D OpenGL and Game Programming video tutorials:
    www.MarekKnows.com
    Play my free games: Ghost Toast, Zing, Jewel Thief

  2. #2
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    You can indeed connect to remote servers, however, not with microsoft access as there is no db server the other end - it requires direct access to the file, eg \\homepc1\share\folder\mydb.mdb, but unless you do your firewall carefully and its limited to specific IPs everyone could play with it - which is why things like MSSQL/mySQL are good as they run over tcp/ip and so do allow for remote access properly
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  3. #3
    Join Date
    Mar 2005
    Location
    Ontario, Canada
    Posts
    1,750
    I found this posting on some newsgroups:
    I'm new to ODBC, I need your help. The thing is I have to retrive data from a table reside in remote SQL server, I know ODBC is just an interface between my VC++(6.0) application and database, ODBC does not deal with communication, My question is how to set up a connection to access a remote database and then talk with it through ODBC in my application.
    They were trying to do the exact same thing as me. The solution to their problem was posted:

    You will need to create a logical link between your machine and the remote ODBC data source. This is done by running the "ODBC Sources" program in the Control Panel folder. On some versions of windows this program is found under Administrative Tools. This program will allow you to associate a name known locally by your computer, say "Remote ODBC Server" with the remote server. You can then use the Open member function of either CDatabase or CDaoDatabase in your C++ program to make a connection to the remote data source. After this connection is made you can access the remote data just as if it was a local SQL Server or Microsoft ACCESS database.
    I've gone into Control Panel->Administrative Tools->Data Sources (ODBC)
    I created a new Data source but I can't seem to figure out how to associate it with the remote Access database found on your web server.
    C++, 3D OpenGL and Game Programming video tutorials:
    www.MarekKnows.com
    Play my free games: Ghost Toast, Zing, Jewel Thief

  4. #4
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    Hmm for a remote ODBC server Id expect you'd need to run specific software, and install a client - Im not aware (its possible Im not an ODBC godess) of it handling remote ODBC like that by default.
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  5. #5
    Join Date
    Mar 2005
    Location
    Ontario, Canada
    Posts
    1,750
    If it can't be done using ODBC then how can I get a C++ application to talk to an Access database on a remote server on the internet?

    There must be a standard way to do this for business applications or even game servers.
    C++, 3D OpenGL and Game Programming video tutorials:
    www.MarekKnows.com
    Play my free games: Ghost Toast, Zing, Jewel Thief

  6. #6
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    Games and business tend to use mysql, oracle, firebird or mssql as it irepresents a "proper" database.

    If you had full controll of the remote server you could write an app to hand you your data.. but it would be pointless with something as poor as access underneath
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  7. #7
    Join Date
    Mar 2005
    Location
    Ontario, Canada
    Posts
    1,750
    How do you form a connection between a standalone application on a PC to a SQL server on the internet?

    I'm guessing there is an API that handles all the details?
    C++, 3D OpenGL and Game Programming video tutorials:
    www.MarekKnows.com
    Play my free games: Ghost Toast, Zing, Jewel Thief

  8. #8
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    yep. Sure is.
    However, what you use and how depends on whats on the server the other end.

    Like most things, you download a set of libraries and use their APIs.
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

  9. #9
    Join Date
    Mar 2005
    Location
    Ontario, Canada
    Posts
    1,750
    What is it that I need to get this to work?

    I need a database on the server end (I don't care what kind, so long as I can use SQL commands to manipulate the data)

    I need an API to talk to this database from my application (again I don't care what it is, so long as I can use it in my C++ code).

    I'm using goDaddy as my web host.
    C++, 3D OpenGL and Game Programming video tutorials:
    www.MarekKnows.com
    Play my free games: Ghost Toast, Zing, Jewel Thief

  10. #10
    Join Date
    Nov 2006
    Location
    UK
    Posts
    3,774
    Well goDaddy would provide the database type - you may need to pay extra, and not all of them allow remote connections.

    Easiest one I know to look at is go look at mysql, it has a server, the libraries and api stuff you need with examples - it will get you the idea.
    Delphi !ROCKS!
    Got a question? Read this first!!!
    "You gotta help us, Doc. We've tried nothin' and we're all out of ideas"

Page 1 of 2 12 LastLast

Posting Permissions

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