淘主机 发表于 2009-5-2 11:09:19

国外Plesk面板的Asp空间不支持Access数据库的处理方法

国外Windows的ASP空间一般都是Plesk面板,有些支持access数据库,使用比较方便;
但有些需要设置 odbc dsn连接,才可以使用ms access数据库,否则容易出现500 Internal Server Error 错误。

让Plesk面板Windows空间支持access数据库(.MDB,.MDF等等)的设置方法如下:

按照下面步骤操作:

首先,先在网站目录下(httpdocs)建立一个文件夹,给足读写权限,这个可以远程操作,也可以在Plesk控制面板点击Padlock图标(就是一个小锁头),这个图标在File manager里可以找到,文件夹右侧,金黄色的小锁头。

如果以前网站有数据库的 直接就可以操作权限了,不用建立新的目录。

都做好了以后。在Plesk控制面板,点击左侧的Domains,进入域名管理,找到要设置的域名,点击进入,找到并点击ODBC图标,进入,点击Add New ODBC DSN,进入建立页面,填入一个ODBC的名称,描述,选择“Microsoft Access Database (.mdf)” ,点击OK,进入下一步,在* Database File Path这里,填入详细的数据库的路径。比如:C:\Inetpub\vhosts\yourdomain.com\httpdocs\folderyourcreated\database.mdb

这个路径根据你自己的服务器来看,一般是上面的格式,yourdomain.com这个换成你的域名,folderyourcreated这个换成你建立的目录就行了。

设置好以后点击next,然后点击完成。如果不报错说明数据库没问题。如果有问题重新设置路径,点Test,没问题后点Finish。

这样就准备好了。

最后一步就是修改你的数据库连接文件,一般是conn.asp之类的,连接部分改成如下格式:

strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\vhosts\yourdomain.com\httpdocs\folderyourcreated\database.mdf"

这样就完全搞定了。一定要注意连接的文件一定要写好。我们只是写了关键部分,其他部分自己找下资料。

下面是英文的原文:

How to use a Microsoft Access Database (.mdf file) on Plesk?

To use a Microsoft Access Database (.mdf file), you will need to create a folder in your web space (inside the httpdocs folder) and give this folder full write permissions using the file manager in your Plesk control panel (click the padlock icon next to the folder you have created to set the permissions).

Once the database has been uploaded, you may wish to setup an ODBC connection to the database for easier connection.

Click the ODBC icon in your Plesk control panel for the domain. Next, click “Add New ODBC DNS”. Give the connection a name. Select the driver as “Microsoft Access Database (.mdf)” and click ok. In the field DB File Path *, enter the server path to your database file you have uploaded to your web space e.g. C:\Inetpub\vhosts\yourdomain.com\httpdocs\folderyourcreated\database.mdf - Replace ‘yourdomain.com’ with your domain name. Replace ‘folderyourcreated’, with the folder you created in step 1. Replace ‘database.mdf’ with the name of your database file.

Leave all the other settings as default. Next, click test connection. It connect is successful, then click next and then ok. If the connection is unsuccessful, please ensure the server path to the database is correct.

If you want to connect to the database using your scripts, you can use:

strConnString = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\vhosts\yourdomain.com\httpdocs\folderyourcreated\database.mdf” ‘## MS Access 2000

淘主机 发表于 2009-5-2 11:09:42

有问题可以按照签名方式联系我们。
页: [1]
查看完整版本: 国外Plesk面板的Asp空间不支持Access数据库的处理方法