Results 1 to 10 of 10

Thread: Opening many public connection objects (using different databases), is it okay?

  1. #1

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Arrow Opening many public connection objects (using different databases), is it okay?

    It is recommended to use one public connection but what if one has to connect to different databases at once? Is it okay to use two public connection objects? We separated the database for our transaction logs hence I need to have a connection object for it also...

    Thanks!
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  2. #2
    Fanatic Member kaffenils's Avatar
    Join Date
    Apr 2004
    Location
    Norway
    Posts
    946

    Re: Opening many public connection objects (using different databases), is it okay?

    Quote Originally Posted by dee-u
    It is recommended to use one public connection but what if one has to connect to different databases at once? Is it okay to use two public connection objects? We separated the database for our transaction logs hence I need to have a connection object for it also...

    Thanks!
    Are the databases on the same server? Is it SQL server by the way?
    If they are on the same server you only need one connection object, and you don't take up more resources on the server than necessary.
    You can refer to the database objects by using a three-part name, database.owner.objectname, or you can change the database context with the USE function.

  3. #3

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Opening many public connection objects (using different databases), is it okay?

    Sadly it's only for Access...

    But could you give me details on your suggestion? Don't know how to use "Use" if its applicable with Access...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  4. #4
    Fanatic Member kaffenils's Avatar
    Join Date
    Apr 2004
    Location
    Norway
    Posts
    946

    Re: Opening many public connection objects (using different databases), is it okay?

    Quote Originally Posted by dee-u
    Sadly it's only for Access...

    But could you give me details on your suggestion? Don't know how to use "Use" if its applicable with Access...
    If it is Access then I think the only solution is to use multiple connection objects. Does Access have transaction logs?

    The USE function is a SQL Server command, so it doesn't work for you.

  5. #5

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Opening many public connection objects (using different databases), is it okay?

    AFAIK Access doesn't have transaction logs... Thanks, I'll still wait for the recommendation of other experts...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  6. #6
    Fanatic Member kaffenils's Avatar
    Join Date
    Apr 2004
    Location
    Norway
    Posts
    946

    Re: Opening many public connection objects (using different databases), is it okay?

    Quote Originally Posted by dee-u
    AFAIK Access doesn't have transaction logs
    Thats what I though, but you wrote this
    We separated the database for our transaction logs
    in the first post.

  7. #7

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Opening many public connection objects (using different databases), is it okay?

    Sorry, its a Transaction Log for our application, not related to the one in SQL Server...
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  8. #8
    Frenzied Member pnish's Avatar
    Join Date
    Aug 2002
    Location
    Tassie, Oz
    Posts
    1,918

    Re: Opening many public connection objects (using different databases), is it okay?

    I don't think there's too much of a problem having multiple connections open. We have a similar situation where the data must come from several different databases. Some of our apps can have up to 5 different connections open and it doesn't appear to cause any problems. I guess it all depends how many concurrent users there are.

    One way around the problem would be to link the tables so they all appear in the same database, that way you can use a single connection.
    Pete

    No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.

  9. #9

    Thread Starter
    Software Carpenter dee-u's Avatar
    Join Date
    Feb 2005
    Location
    Pinas
    Posts
    11,127

    Re: Opening many public connection objects (using different databases), is it okay?

    Thanks fellow VBFer's, I think I have no choice but use more than one public connection...

    I wouldn't mark this thread as resolved yet, recommendations and suggestion are still welcome...
    Last edited by dee-u; Nov 7th, 2005 at 03:14 AM.
    Regards,


    As a gesture of gratitude please consider rating helpful posts. c",)

    Some stuffs: Mouse Hotkey | Compress file using SQL Server! | WPF - Rounded Combobox | WPF - Notify Icon and Balloon | NetVerser - a WPF chatting system

  10. #10
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Opening many public connection objects (using different databases), is it okay?

    You can use a single connection, and just specify the database within Access SQL statements, eg:
    Code:
    SELECT table1.field1 FROM [c:\path\database.mdb].table1
    (the syntax may not be quite right here!)

    However an extra connection object would be more efficient in this case, as you are basically connecting to one database file and then re-routing to another - a direct link would be faster.

    If you are trying to create cross-database queries tho, using a variation of the above method will obviously be more efficient than joining two recordsets yourself.

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