|
<P ><FONT size=3>两种<FONT face="Times New Roman">db</FONT>数据库的打开方式</FONT></P>
<P ><FONT size=3>现在桌面级的各种管理系统使用的数据库都是比较常见的类型,比如<FONT face="Times New Roman">Access</FONT>数据库(扩展名为<FONT face="Times New Roman">mdb</FONT>)、<FONT face="Times New Roman">xBase</FONT>类数据库(扩展名为<FONT face="Times New Roman">dbf</FONT>),但有两种扩展名同为<FONT face="Times New Roman">db</FONT>的数据库,分属两个公司的产品,一个是老牌桌面数据库<FONT face="Times New Roman">Paradox</FONT>,这是<FONT face="Times New Roman">Borland</FONT>公司的产品,其广泛使用的时代是在<FONT face="Times New Roman">Dos</FONT>时期,但现在仍有用<FONT face="Times New Roman">Delphi</FONT>、<FONT face="Times New Roman">C++Builder</FONT>等工具开发的产品使用这一类型的数据库,<FONT face="Times New Roman">Microsoft</FONT>的桌面数据引擎<FONT face="Times New Roman">JET</FONT>对其支持也比较完整;另一个是<FONT face="Times New Roman">Sybase</FONT>的<FONT face="Times New Roman">ASA</FONT>数据库,全称叫做<FONT face="Times New Roman">Adaptive Server Anywhere</FONT>,这个数据库以前被称作<FONT face="Times New Roman">Sql Anywhere</FONT>,这个数据库不仅可以用在桌面级,还可以用于服务器级,因为其支持存储过程、触发器等,一般在使用<FONT face="Times New Roman">PowerBuilder</FONT>开发的产品中很常见,因为毕竟是同一个公司的产品。这两个数据库都可以通过<FONT face="Times New Roman">Ado</FONT>来访问,在网上比较流行的链接字符串中都有其介绍,但屡次试验后均不成功,经过数番摸索终于找到其链接字串,现在简介如下:</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">Paradox</FONT>的链接字串:</FONT></P>
<P ><FONT face="Times New Roman" size=3>conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman"> & "Data Source=" & </FONT>数据库文件存放目录<FONT face="Times New Roman"> _</FONT></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman"> & ";Jet OLEDB:Engine Type=82;"</FONT></FONT></P>
<P ><FONT size=3>这里使用<FONT face="Times New Roman">JET</FONT>引擎提供的链接字串,这里有两点需要注意,一是<FONT face="Times New Roman">Jet OLEDB:Engine Type=82</FONT>,这是<FONT face="Times New Roman">JET</FONT>引擎为<FONT face="Times New Roman">Paradox</FONT>数据库提供的驱动类型编号,二是<FONT face="Times New Roman">Data Source</FONT>的值为数据库文件存放路径,而不是数据文件本身,另外还有一点至关重要那就是需要在安装<FONT face="Times New Roman">BDE</FONT>(<FONT face="Times New Roman">Borland Data Engine</FONT>)的机器上才可以运行。<B ><p></p></B></FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">ASA</FONT>的链接字串:</FONT></P>
<P ><FONT size=3><FONT face="Times New Roman">conn.ConnectionString = "Driver={Adaptive Server Anywhere 8.0};DatabaseFile=</FONT>数据库文件全路径名<FONT face="Times New Roman">;Uid=DBA;Pwd=SQL"</FONT></FONT></P>
<P ><FONT size=3>同样这也是必须在安装<FONT face="Times New Roman">ASA</FONT>的机器上运行,其中的<FONT face="Times New Roman">8.0</FONT>是指数据库的版本,打开目标机器的<FONT face="Times New Roman">ODBC</FONT>管理器,看看都有那个类型的版本,修改为对应的就应该可以了。<FONT face="Times New Roman">Uid=DBA;Pwd=SQL</FONT>,这是该类型数据库的超级用户名及密码,这是默认的,对于改动过的密码,就要想想其他办法了。</FONT></P>
<P ><FONT size=3>还有一些扩展名为<FONT face="Times New Roman">db</FONT>的数据库文件,多数都是经过改变扩展名的其他类型数据库,比如把<FONT face="Times New Roman">DBF</FONT>或<FONT face="Times New Roman">MDB</FONT>的扩展名改为<FONT face="Times New Roman">db</FONT>等等,这时大家再判断一下属于哪种数据库吧。</FONT></P>
<P ><p><FONT face="Times New Roman" size=3> </FONT></p></P>
<P ><p><FONT face="Times New Roman" size=3></FONT></p> </P>
<P ><p><FONT face="Times New Roman" size=3>这是我前几天使用以上两种数据库时的心得,以前曾有朋友问过db数据库的打开方式,我想可能有朋友用的上,就贴出来了</FONT></p></P> |
|