Menu

access to several databases in one project

2004-08-26
2004-09-17
  • Nobody/Anonymous

    Hi

    Can anyone show me how to do, in order to have one factory class mapping to a table in database a, and another factory class mapping to a table in database b ?

     
    • Nobody/Anonymous

      i got myself some kind of answer:
      "One database, One project"
      (and just add the reference in the first project)

      r0dy

       
      • Peter Gebruers

        Peter Gebruers - 2004-09-06

        I use gentle 1.0.4 and ms sql server. I used the following trick to access another database on the same server:
        [TableName("Helpdesk.dbo.Issues")]
        class Issues:Persistent
        {
        }

        Using the notation database.owner.table doesn't help you with authentication, but if you can use one login for both it is ok

         
    • Nobody/Anonymous

      and no, it doesn't even work!
      even if i put in my factory constructor, this.broker = new PersistenceBroker("SQLServer", "Data Source=(local);Initial Catalog=ik;Integrated Security=True;Connection Timeout=1;"); it doesn't work!
      it keeps saying: The table Messages to which type VPFrontWebCore.ik.hDoc maps does not exist.
      anyone has an example ?
      I'm currently making one in a simple solution, but still doesn't work at the moment.

       
      • Morten Mertner

        Morten Mertner - 2004-08-31

        I believe you need to access the databases in separate threads due to some internal caching of metadata. As far as I can remember data (obtained by the db abalyzer) is cached in a ThreadStatic marked member, so access to another provider/database would need to use a new thread to ensure that the analyzer runs again. This is required because type codes and other data is vendor specific (the DbType enum does not cover all required types, and Gentle does not yet have a generic type classification of its own).

         
    • gfiorentini

      gfiorentini - 2004-09-02

      Can you provide code example for accessing multiple database in one project ?

      10x in advance.

       
    • Nobody/Anonymous

      it doesn't work at all... as i said in the "still multibase problems" post, even with the last code progresses, we're unable to make it.
      r0dy

       
    • Nobody/Anonymous

      i've tried it but that doesn't work for me, thnx anyway.

      r0dy

       
    • Morten Mertner

      Morten Mertner - 2004-09-13

      If you're still having this problem, could you perhaps try to debug it and let me know where Gentle breaks?

      Also, did you notice that it's possible to map a namespace to a certain database using the config file:

      <NamespaceProviders>
              <Namespace namespace="Northwind" provider="SQLServer" connectionstring="data source=localhost;initial catalog=Northwind;" />
              <Namespace namespace="Example.Pubs" provider="SQLServer" connectionstring="data source=localhost;initial catalog=Pubs;" />
          </NamespaceProviders>

      When present, these will be used in place of the DefaultProvider, for classes matching the namespace.

       
    • Nobody/Anonymous

      Morten, as i already posted it, the namespace system doesn't work... or is ut just that there is something i missed ?
      tell me if you wanna have my simple example sources: r0dy@r0dy.net

      r0dy

       
    • Nobody/Anonymous

      Morten, as i posted it, the namespace system doesn't work... or is it that i missed something ?
      I've downloaded the sources, recompiled, put all as described in the config file, but no changes when calling classes from different namespaces!
      If you wanna see my simple example sources, mail me at r0dy@r0dy.net

      r0dy

       

Log in to post a comment.