[提问]
godaddy主机用PLESK,access数据库得用专门的odbc dsn来连接?
|
|
是不是godaddy主机用PLESK控制面板,access数据库得用专门的odbc dsn来连接?
刚买了一个godaddy的windows主机用的PLESK的控制面板,用的asp access数据库,程序在ixwebhosting下面从来没出过问题,但到了godaddy下就显示 "The page cannot be displayed because an internal server error has occurred." 也不知道怎么解决,麻烦朋友们帮忙解答一下。 |
|
|
|
|
|
|
|
|
|
|
tpxp
发表于 2010-10-25 11:26:39
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
add.c
发表于 2010-10-25 11:37:43
|
显示全部楼层
回复 1# 的帖子
GoDaddy服务器或者虚拟主机才有plesk面板
虚拟主机你只要保持access数据库所在目录有读写权限即可 |
|
|
|
|
|
|
|
|
|
|
laodifangderen
发表于 2010-10-25 11:45:34
|
显示全部楼层
我买的是virtual servers花了大概四面美金,PLESK是另外掏钱买的,程序在IXwebhoistng下面是没事的,一切ok,
数据库文件就是 *.mdb的文件 IUSR_*给了全部的权限,但还是出现上述错误。 |
|
|
|
|
|
|
|
|
|
|
laodifangderen
发表于 2010-10-25 11:50:51
|
显示全部楼层
|
要不我给大家PLESK的管理用户名和密码,那位能帮忙上去看看,感激中。。。 |
|
|
|
|
|
|
|
|
|
|
add.c
发表于 2010-10-25 12:38:02
|
显示全部楼层
不知道你用的
使用ASP/ADO连接access数据库代码
<%
Dim oConn, oRs
Dim qry, connectstr
Dim db_path
Dim db_dir
db_dir = Server.MapPath("access_db") & "\"
db_path = db_dir & "yourdatabasefile.mdb"
fieldname = "your_field"
tablename = "your_table"
connectstr = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" & db_path
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
qry = "SELECT * FROM " & tablename
Set oRS = oConn.Execute(qry)
if not oRS.EOF then
while not oRS.EOF
response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & ""
oRS.movenext
wend
oRS.close
end if
Set oRs = nothing
Set oConn = nothing
%>
另外一个连接到DSN DSN and ASP/ADO- <%
- Dim oConn, oRs
- Dim qry, connectstr, sDSNDir
- Dim db_name, db_username, db_userpassword
- Dim dsn_name
- dsn_name = "your_dsn_name"
- fieldname = "your_fieldname"
- tablename = "your_tablename"
- 'assumes that _dsn exists in the root
- sDSNDir = Server.MapPath("/_dsn")
- connectstr = "filedsn=" & sDSNDir & "/" & dsn_name
- Set oConn = Server.CreateObject("ADODB.Connection")
- oConn.Open connectstr
- qry = "SELECT * FROM " & tablename
- Set oRS = oConn.Execute(qry)
- if not oRS.EOF then
- while not oRS.EOF
- response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & " "
- oRS.movenext
- wend
- oRS.close
- end if
- Set oRs = nothing
- Set oConn = nothing
- %>
复制代码 |
|
|
|
|
|
|
|
|
|
|
laodifangderen
发表于 2010-10-25 13:46:44
|
显示全部楼层
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<%' Option Explicit %>
<%
' ============================================
' 常用全局变量
' ============================================
' 数据库对象
Dim oConn, oRs, sSql
' ============================================
' 初始数据处理
' ============================================
' 初始化数据库连接
Call DBConnBegin()
'response.write "连接成功"
' ********************************************
' 以下为数据库相关函数
' ********************************************
' ============================================
' 初始化数据库连接对象
' 使用原则:最迟调用,最早释放
' ============================================
Sub DBConnBegin()
' 如果数据库对象已打开,不要再打开
If IsObject(oConn) = True Then Exit Sub
' 你可以不需要打开数据库连接对象而直接打开记录集对象,但如果你需要打开多个记录集对象的话,效率是很低的。
' 如果你不创建一个数据库连接对象,ADO会在每个记录集打开时自动创建一个新的数据库连接对象,就算你用的是相同的SQL语句。
Set oConn = Server.CreateObject("ADODB.Connection")
On Error Resume Next
' Access数据库
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("/mydatazw/#mydatazw.mdb")
If Err.Number > 0 Then
' 显示错误信息,并且发送邮件通知管理员
'Call DBConnError(Err)
' 完全地退出正在运行的脚本
Response.End
End If
' 创建一个记录集
Set oRs = Server.CreateObject( "ADODB.Recordset" )
End Sub
' ============================================
' 释放数据库连接对象
' ============================================
Sub DBConnEnd()
On Error Resume Next
oRs.Close
Set oRs = Nothing
oConn.Close
Set oConn = Nothing
End Sub
%> |
|
|
|
|
|
|
|
|
|
|
laodifangderen
发表于 2010-10-25 13:51:12
|
显示全部楼层
用PLESK创建odbc dsn后 填入相应项目,有个测试选项,是正确的。
然后我就把地址改成
oConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("C:\Inetpub\vhosts\shibang-china.com\httpdocs\mydatazw\#mydatazw.mdb")
但实际运行过程中,还是提示内容服务器错误。 |
|
|
|
|
|
|
|
|
|
|
add.c
发表于 2010-10-25 14:06:50
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|
laodifangderen
发表于 2010-10-25 14:20:34
|
显示全部楼层

这是通过RDC链接看到的,应该没有错误的。 |
|
|
|
|
|
|
|
|