Connection problems

  • Thread starter Thread starter Roy Gourgi
  • Start date Start date
R

Roy Gourgi

Hi,

I just install MSDE 2000 on my computer and I am trying to make a connection
with the server but it does not seem to be working. What am I doing wrong in
the code below? When I open my Server Explorer I see Data Connections and
Servers. Do I have to make a physical connection of some sort first? In the
Servers section, I see that it automatically created a SQL server by the
name REBORN where I created a database called royDB. Am I using the wrong
parameters below for the connections string:

string strConnection = "server=(local)\\REBORN;" +

"uid=QSUser;pwd=QSPassword;" +

"database=royDB";


Here is my code below.
TIA
Roy



using System;

using System.Data;

using System.Data.SqlClient;

using System.Data.SqlTypes;

namespace testing

{

/// <summary>

/// Summary description for Class1.

/// </summary>

class Class1

{

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main(string[] args)

{

//Program Files\\Miscrosoft SQL Server\\MSSQL\\Data;" +

string strConnection = "server=(local)\\REBORN;" +

"uid=QSUser;pwd=QSPassword;" +

"database=royDB";

SqlConnection conn = new SqlConnection(strConnection);


conn.Open();


conn.Close();


}

}

}
 
Hi Pete,

I tried that and it did not work, but I found the problem. Strangely enough
when I changed my connection string to the following it worked. If I remove
the Integrated Security from this string, it all will not work. Do you know
why by any chance.

strConnection = "Server=(local);Integrated Security=yes;database=royDB";

Thanks
Roy

Pete Davis said:
server=(local)

or

server=REBORN

The server is the local server. It also happens to be called "REBORN".

I think that should fix it.

Pete

Roy Gourgi said:
Hi,

I just install MSDE 2000 on my computer and I am trying to make a
connection with the server but it does not seem to be working. What am I
doing wrong in the code below? When I open my Server Explorer I see Data
Connections and Servers. Do I have to make a physical connection of some
sort first? In the Servers section, I see that it automatically created a
SQL server by the name REBORN where I created a database called royDB. Am
I using the wrong parameters below for the connections string:

string strConnection = "server=(local)\\REBORN;" +

"uid=QSUser;pwd=QSPassword;" +

"database=royDB";


Here is my code below.
TIA
Roy



using System;

using System.Data;

using System.Data.SqlClient;

using System.Data.SqlTypes;

namespace testing

{

/// <summary>

/// Summary description for Class1.

/// </summary>

class Class1

{

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main(string[] args)

{

//Program Files\\Miscrosoft SQL Server\\MSSQL\\Data;" +

string strConnection = "server=(local)\\REBORN;" +

"uid=QSUser;pwd=QSPassword;" +

"database=royDB";

SqlConnection conn = new SqlConnection(strConnection);


conn.Open();


conn.Close();


}

}

}
 
server=(local)

or

server=REBORN

The server is the local server. It also happens to be called "REBORN".

I think that should fix it.

Pete
 
Ah,

I hadn't thought of that. The uid and pwd are used for SQL security, which
isn't the default in MSDE. The default is integrated security. SQL Security
isn't very "secure" as it passes the plaintext userid and password across
the wire, wherease integrated security uses NT security and is much more
secure.

Pete

Roy Gourgi said:
Hi Pete,

I tried that and it did not work, but I found the problem. Strangely
enough when I changed my connection string to the following it worked. If
I remove the Integrated Security from this string, it all will not work.
Do you know why by any chance.

strConnection = "Server=(local);Integrated Security=yes;database=royDB";

Thanks
Roy

Pete Davis said:
server=(local)

or

server=REBORN

The server is the local server. It also happens to be called "REBORN".

I think that should fix it.

Pete

Roy Gourgi said:
Hi,

I just install MSDE 2000 on my computer and I am trying to make a
connection with the server but it does not seem to be working. What am I
doing wrong in the code below? When I open my Server Explorer I see Data
Connections and Servers. Do I have to make a physical connection of some
sort first? In the Servers section, I see that it automatically created
a SQL server by the name REBORN where I created a database called royDB.
Am I using the wrong parameters below for the connections string:

string strConnection = "server=(local)\\REBORN;" +

"uid=QSUser;pwd=QSPassword;" +

"database=royDB";


Here is my code below.
TIA
Roy



using System;

using System.Data;

using System.Data.SqlClient;

using System.Data.SqlTypes;

namespace testing

{

/// <summary>

/// Summary description for Class1.

/// </summary>

class Class1

{

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main(string[] args)

{

//Program Files\\Miscrosoft SQL Server\\MSSQL\\Data;" +

string strConnection = "server=(local)\\REBORN;" +

"uid=QSUser;pwd=QSPassword;" +

"database=royDB";

SqlConnection conn = new SqlConnection(strConnection);


conn.Open();


conn.Close();


}

}

}
 
Um... I think I have got that to work with userid and password, but the
userid was passed as "user=", not "uid="

Pete Davis said:
Ah,

I hadn't thought of that. The uid and pwd are used for SQL security, which
isn't the default in MSDE. The default is integrated security. SQL Security
isn't very "secure" as it passes the plaintext userid and password across
the wire, wherease integrated security uses NT security and is much more
secure.

Pete

Roy Gourgi said:
Hi Pete,

I tried that and it did not work, but I found the problem. Strangely
enough when I changed my connection string to the following it worked. If
I remove the Integrated Security from this string, it all will not work.
Do you know why by any chance.

strConnection = "Server=(local);Integrated Security=yes;database=royDB";

Thanks
Roy

Pete Davis said:
server=(local)

or

server=REBORN

The server is the local server. It also happens to be called "REBORN".

I think that should fix it.

Pete

Hi,

I just install MSDE 2000 on my computer and I am trying to make a
connection with the server but it does not seem to be working. What am I
doing wrong in the code below? When I open my Server Explorer I see Data
Connections and Servers. Do I have to make a physical connection of some
sort first? In the Servers section, I see that it automatically created
a SQL server by the name REBORN where I created a database called royDB.
Am I using the wrong parameters below for the connections string:

string strConnection = "server=(local)\\REBORN;" +

"uid=QSUser;pwd=QSPassword;" +

"database=royDB";


Here is my code below.
TIA
Roy



using System;

using System.Data;

using System.Data.SqlClient;

using System.Data.SqlTypes;

namespace testing

{

/// <summary>

/// Summary description for Class1.

/// </summary>

class Class1

{

/// <summary>

/// The main entry point for the application.

/// </summary>

[STAThread]

static void Main(string[] args)

{

//Program Files\\Miscrosoft SQL Server\\MSSQL\\Data;" +

string strConnection = "server=(local)\\REBORN;" +

"uid=QSUser;pwd=QSPassword;" +

"database=royDB";

SqlConnection conn = new SqlConnection(strConnection);


conn.Open();


conn.Close();


}

}

}
 
Back
Top