多线程数据库里为什么每个数据集要配一个session,它只是用来获得一些数据库别名和数据库的信息嘛,我在程序(数据集组件上)里指明是哪个别名就是了嘛,为什么一定要session来得呢,谢谢大家帮我讲明白,这个session在这的作用到底是做什么的啊。

解决方案 »

  1.   

    Use TSession to manage a group of database connections within an application. There are three uses for TSession: standard, multiple net files for Paradox, and multi-threaded database applications.The library automatically creates a globally accessible default TSession component named Session for all database applications. The default session component handles standard database connections. An application can control the default session by accessing its properties, events, and methods at runtime.Database applications that must simultaneously access Paradox tables located in different network locations can establish multiple sessions, one for each network location.Finally, database applications that must establish multiple, concurrent connections to the same database, such as performing two queries against the same data at once, are multi-threaded applications. Multi-threaded applications must create and maintain one additional session component for each simultaneous connection to a single database server.Note: Applications that maintain multiple sessions can manage them through the TSessionList component. A default session list component, called Sessions梟ote the plural which distinguishes it from the default session component, Session梚s automatically created for all database applications.
    Note: TSession implements the IDBSession interface, which allows the global PasswordDialog function to supply passwords to the component.
      

  2.   

    不知道我这样理解对不对,其实数据集组件并不能得到相关数据库的表名,我们设置好databasename后,之所以能看到tablename里的各个选择是因为系统调用了自动生成的隐式的session的方法,我们才能看到这些表名加以选择,也就是说每个数据库连接都必须有一个session(BDE)。