Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Sql Connection to Godaddy MSSQL Server

Posted on 2004-11-20
Medium Priority
Last Modified: 2007-12-19
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.secureserver.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.Connection")
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;Data Source=whsql01.mesa1.secureserver.net;Initial Catalog=" & dbname & ";User Id=" & db_username & ";Password=" & dbpassword)

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.
Question by:johnywhite
  • 4
  • 2
  • 2
  • +1

Accepted Solution

abanup earned 2000 total points
ID: 12634870
As ur database is SQL Server, if possible  use System.Data.SqlClient.SqlConnection rather than OleDbConnection (beacuse it is more faster and efficient).

1)In case System.Data.SqlClient.SqlConnection :
      using System.Data.SqlClient
      dim connec As New SqlConnection("DataSource=whsql01.mesa1.secureserver.net;Initial  
      Catalog=" & dbname & ";User Id=" & db_username & ";Password=" & dbpassword)
      note : Not use provider

2) In case OleDbConnection :
       dim connec As New OleDbConnection("Provider=SQLOLEDB.1;Data        
       Source=whsql01.mesa1.secureserver.net;Initial Catalog=" & dbname & ";User Id=" & 
       db_username & ";Password=" & dbpassword)

      note : Now Provider is SQLOLEDB.1


Author Comment

ID: 12635095
I tried both of those and still the same error. "SQL Server does not exist or access denied."

Expert Comment

ID: 12635159
try this:

dim connec As New SqlConnection("Integrated Security=SSPI; Persist Security Info=False; DataSource=whsql01.mesa1.secureserver.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);
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Author Comment

ID: 12635559
Same error. "SQL Server does not exist or access denied."

Data Source and Initial Catalog require spaces.  Just for if anyone else ever uses this in the future.
LVL 18

Expert Comment

ID: 12636348
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.

Author Comment

ID: 12636511
I am using the Delux with Asp.  My web site is also written in .NET and it works just fine.
LVL 18

Expert Comment

ID: 12636937
I suggest you talk to them about the exact SQL Server name. Because your connection string looks just fine. There is absolutely no problem.
LVL 70

Expert Comment

by:Éric Moreau
ID: 12639043
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

Author Comment

ID: 12656787
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.

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question