Archived

This forum has been archived. Please start a new discussion on GitHub.

[freeze]how to creat many different connectors in an application?

in the document , there is a description as follows:
Next, the code instantiates the StringIntMap on the connection. The
constructor’s second argument supplies the name of the database file, which by default is created if it does not exist. Note that a database can only contain the persistent state of one map type. Any attempt to instantiate maps of different types on the same database results in undefined behavior.

what is that to say ?
is it to say :
i could not connect different map files to the same connector?
as follows :
mapNameUserInfo = new NameUserInfoMap( ptrConn , "nameuserinfomap" );
mapIdGameInfo = new IdGameInfoMap( ptrConn , "idgameinfomap" );
//mapNameUserInfo and mapIdGameInfo are the different maps.

and if i would like to use many different maps ,how to do ?
and how to creat many different connectors in an application?
when i created two or more connectors ,i meet a run time error .

Comments

  • benoit
    benoit Rennes, France
    No, that's not what it means. It means that you can't do the following:
    mapNameUserInfo = new NameUserInfoMap( ptrConn , "MAP" );
    mapIdGameInfo = new IdGameInfoMap( ptrConn , "MAP" );

    That is, you can't open the same database with different map types. The code you've posted looks correct, you can of course use the same Freeze connection to open multiple maps.

    Note that you should also be able to create multiple Freeze connections. If you provide more information on the runtime error you've seen, I might be able to help. Please also specify which platform and Ice version you are using.

    Benoit.