Results 1 to 7 of 7
  1. #1
    Join Date
    May 2001
    Posts
    51

    Unanswered: Multiple Databases

    Hi all, in a bit of a pickle, hope you can help.

    Assume i have 1 database with a users and a comments table, the, followign sql is fine,

    SELECT u.name, c.comment FROM user u, comment c WHERE c.userid = u.userid;

    Now, how could this be achived if the user table was held in a different database? How would it work?

    Help

    Taz

  2. #2
    Join Date
    Jan 2003
    Location
    Vietnam
    Posts
    188

    Re: Multiple Databases

    Originally posted by etones
    Hi all, in a bit of a pickle, hope you can help.

    Assume i have 1 database with a users and a comments table, the, followign sql is fine,

    SELECT u.name, c.comment FROM user u, comment c WHERE c.userid = u.userid;

    Now, how could this be achived if the user table was held in a different database? How would it work?

    Help

    Taz
    Hi, you can achive this easily with a ms access file with linked tables through odbc or vb6 data environment designer. No matter what your database servers are as long as you have proper odbc drivers installed. This is not limitted to some databases in mysql but those in mysql and others in mssql, fox, informix, paradox...

    How would it work? based upon the pre-designed linked tables/ or data environment in vb6 the tables/ databases will be automatically connected upon requests from applications.

    Hope this helps


    qha_vn

  3. #3
    Join Date
    Jan 2003
    Location
    Duncan BC Canada
    Posts
    80
    SELECT u.name, c.comment FROM user u, comment c WHERE c.userid = u.userid;

    Now, how could this be achived if the user table was held in a different database?
    Just specify the name of the other database where you refer to the user table. If the other database is called 'data2', your query would look like this:

    Code:
    SELECT u.name, c.comment FROM data2.user u, comment c WHERE c.userid = u.userid;
    Bradley

  4. #4
    Join Date
    May 2001
    Posts
    51
    thanks for the reply bcrockett, does this method only work if the 2 databases are working from from the same username/password and are on the same machine?

    Taz

  5. #5
    Join Date
    Jan 2003
    Location
    Vietnam
    Posts
    188
    the linked tables will work regardless of user name/ password, different machines coz they are all pre-defined as you link the tables.

    not just that, it will work regardless of database types (m$ sql, mysql, oracle, informix...) as long as you have their odbc drivers installed.
    qha_vn

  6. #6
    Join Date
    May 2001
    Posts
    51
    im using php, im not sure its possible via php

  7. #7
    Join Date
    Jan 2003
    Location
    Duncan BC Canada
    Posts
    80
    does this method only work if the 2 databases are working from from the same username/password and are on the same machine?
    For the example I gave, yes. There may be a way to do it across users/machines, but I don't know.
    Bradley

Posting Permissions

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