johnywhite
asked on
Sql Connection to Godaddy MSSQL Server
I have a GoDaddy web-hosting account. They allow me to create a SQL Server 200 Database. They have given me code for asp, however I am using asp.net w/vb.net codebehind. The code that they have given me to connect to their database in asp is:
Dim oConn, oRs
Dim qry, connectstr
Dim db_name, db_username, db_userpassword
Dim db_server
db_server = "whsql01.mesa1.secureserve r.net"
db_name = "your_dbname"
db_username = "your_dbusername"
db_userpassword = "your_dbpassword"
connectstr = "Driver={SQL Server};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword
Set oConn = Server.CreateObject("ADODB .Connectio n")
oConn.Open connectstr
My code in VB.NET is this:
dim dbname as string = "my database name"
dim db_username as string = "my user name"
dim dbpassword as string = "my password"
dim connec As New OleDbConnection("Provider= SQLOLEDB;D ata Source=whsql01.mesa1.secur eserver.ne t;Initial Catalog=" & dbname & ";User Id=" & db_username & ";Password=" & dbpassword)
connec.open()
I have also tried using OdbcConnection with the exact same string as their connectstr. With both ways I get the error SQL Server not found or access denied. I was wondering if anyone has a solution for this or experienced the same thing with GoDaddy? Is there something different with the way asp connects as to the way asp.net does? Any help would be appreciated.
Dim oConn, oRs
Dim qry, connectstr
Dim db_name, db_username, db_userpassword
Dim db_server
db_server = "whsql01.mesa1.secureserve
db_name = "your_dbname"
db_username = "your_dbusername"
db_userpassword = "your_dbpassword"
connectstr = "Driver={SQL Server};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword
Set oConn = Server.CreateObject("ADODB
oConn.Open connectstr
My code in VB.NET is this:
dim dbname as string = "my database name"
dim db_username as string = "my user name"
dim dbpassword as string = "my password"
dim connec As New OleDbConnection("Provider=
connec.open()
I have also tried using OdbcConnection with the exact same string as their connectstr. With both ways I get the error SQL Server not found or access denied. I was wondering if anyone has a solution for this or experienced the same thing with GoDaddy? Is there something different with the way asp connects as to the way asp.net does? Any help would be appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi
try this:
dim connec As New SqlConnection("Integrated Security=SSPI; Persist Security Info=False; DataSource=whsql01.mesa1.s ecureserve r.net; InitialCatalog=" & dbname & "; User Id=" & db_username & "; Password=" & dbpassword)
note: try to give space after semicoln (but i don't think it cause any problem);
try this:
dim connec As New SqlConnection("Integrated Security=SSPI; Persist Security Info=False; DataSource=whsql01.mesa1.s
note: try to give space after semicoln (but i don't think it cause any problem);
ASKER
Same error. "SQL Server does not exist or access denied."
P.S.
Data Source and Initial Catalog require spaces. Just for if anyone else ever uses this in the future.
P.S.
Data Source and Initial Catalog require spaces. Just for if anyone else ever uses this in the future.
Which service plan you are using ? https://www.godaddy.com/gdshop/hosting/landing.asp?se=%2B&rhl=nv%5Fweb%5F%2Fdefault%5Fhost , it shows Economy Plan does NOT support ASP.Net.
-Baan
-Baan
ASKER
I am using the Delux with Asp. My web site is also written in .NET and it works just fine.
I suggest you talk to them about the exact SQL Server name. Because your connection string looks just fine. There is absolutely no problem.
-Baan
-Baan
Your SQL server does not allow
-Open Enterprise Manager
-Right-click your server
-Click properties
-Open the Security tab
-Set Authentication to "SQL Server and Windows"
-Let the service restart
-Open Enterprise Manager
-Right-click your server
-Click properties
-Open the Security tab
-Set Authentication to "SQL Server and Windows"
-Let the service restart
ASKER
It turns out that they don't allow connections to a database through .NET only through asp, even though they offer .NET as an option.
Thanks for all of the help I appreciate it.
Thanks for all of the help I appreciate it.
ASKER