在www.somee.com上连接到SQL 2005 DB [英] Connecting to SQL 2005 DB on www.somee.com

查看:78
本文介绍了在www.somee.com上连接到SQL 2005 DB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们,



我完成了我的漫画书数据库项目,或者我想。当我上传文件并创建一个新的SQL 2005 DB时,我在从index.asp页面连接到它时遇到了一些麻烦。



我'收到此错误:



[Microsoft] [ODBC驱动程序管理器]未找到数据源名称且未指定默认驱动程序



我正在使用他们建议/给定的连接字符串:



workstation id = ComicsDB.mssql.somee.com;数据包大小= 4096; user id = [myusernamehere]; pwd = [mypasswordhere]; data source = ComicsDB.mssql.somee.com; persist security info = False; initial catalog = ComicsDB



这是'我试图使用的初始连接符代码:



Hey guys,

I finished my comic book database project, or so I thought. When I go to upload the files and make a new SQL 2005 DB, I''m having some trouble connecting to it from my index.asp page.

I''m getting this error:

"[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"

I''m using their suggested/given connection string:

"workstation id=ComicsDB.mssql.somee.com;packet size=4096;user id=[myusernamehere];pwd=[mypasswordhere];data source=ComicsDB.mssql.somee.com;persist security info=False;initial catalog=ComicsDB"

Here''s initial connector code I''m trying to use:

<%
strSQL = "Select * from Info ORDER BY Title ASC;" 'create SQL string

SET DbObj = Server.CreateObject("ADODB.Connection") 'set up the ADO connection
DbObj.Open = "data source=ComicsDB.mssql.somee.com;packet size=4096;user id=[myusernamehere];pwd=[mypasswordhere];persist security info=False;initial catalog=ComicsDB" 
SET oRs = DbObj.Execute(strSQL) 'Execute the SQL statement

%>





我也很困惑,当我联系他们对它的支持时,他说我使用的是ODBC连接器,somee.com不支持他说他尝试使用ADO或者ADO.NET连接。但我认为这是一个ADO连接..... ???



我尝试了另一种连接方法,它应该是一个ADO连接:





What I''m also confused about, was when I contacted their support about it, he said I was using an ODBC connector, which isn''t supported on somee.com and he said to try using an ADO or ADO.NET connection instead. But I thought this was an ADO connection.....???

I did try another connection method, which ''should'' be an ADO connection:

<%
strSQL = "Select * from Info ORDER BY Title ASC;" 'create SQL string (where clauses etc should be added according to what you would like displayed)

Dim DbObj as ADODB.Connection
Set DbObj=New ADODB.Connection
Let DbObj.ConnectionString= "ODBC;DSN=" & ComicsDB.mssql.somee.com & ";UID=" & 
[myusernamehere] & ";PWD=" & [mypasswordhere]
DbObj.Open
SET oRs = DbObj.Execute(strSQL) 'Execute the SQL statement
%>





但是当我使用该代码时,我总是会收到此错误:



Microsoft VBScript编译错误 800a0401''



预计声明结束



/index.asp,第10行



Dim DbObj为ADODB.Connection

---------- ^



有谁能帮我清理这个sql连接?



提前致谢!





Jerome



But when I use that code, I always get this error:

"Microsoft VBScript compilation error ''800a0401''

Expected end of statement

/index.asp, line 10

Dim DbObj as ADODB.Connection"
----------^

Can anyone help me clear this sql connection up?

Thanks in advance!


Jerome

推荐答案

您使用的连接字符串需要DSN,请尝试使用以下链接为SQL 2005提供不同的连接选项的不同选项:



http://www.connectionstrings.com/sql-server-2005 [ ^ ]



Server = myServerAddress; Database = myDataBase; User ID = myUsername; Password = myPassword ; Trusted_Connection = False;
The connection strings you are using requires DSN, try using different options for different connection options to SQL 2005 from the following link:

http://www.connectionstrings.com/sql-server-2005[^]

Server=myServerAddress;Database=myDataBase;User ID=myUsername;Password=myPassword;Trusted_Connection=False;


这是我目前正在使用的somee.com,它运作良好:)



Here''s what I am currently using for somee.com and it works well :)

Dim DbObj
Set DbObj = Server.CreateObject("ADODB.Connection")
DbObj.Open = "Driver={SQL Server};" &_
"packet size=4096;" &_
"Server=[DB Name].mssql.somee.com;" &_
"Database=[DB Name];" &_
"Uid=[Username];" &_
"Pwd=[Password];" &_
"security info=False;" &_
"initial catalog=[DB Name]"
<pre>

Just fill in your data without the [ ]''s and you should be set!  HTH.


Jerome


事实证明问题出在驱动程序规范中。我发现实际上对我有用的解决方案是:



It turns out the problem was in the driver specification. The solution I found that actually works for me is:

Dim DbObj
Set DbObj = Server.CreateObject("ADODB.Connection")
DbObj.Open "Driver={SQL Server Native Client 10.0};" & _
  "packet size=4096;" & _
  "Server=[DB].mssql.somee.com;" & _
  "Database=[DB];" & _
  "Uid=[UserName];" & _
  "Pwd=[Password];" & _
  "security info=False;" & _
  "initial catalog=[DB]"





感谢您的帮助!



Thanks for your help!


这篇关于在www.somee.com上连接到SQL 2005 DB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆