473,387 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

SQL Connecting Problems

A simple app I quickly wrote to try getting info from a database. Here
is the first part of its code. The rest of the code is irellevant.
using System;
using System.Data;
using System.Data.SqlClient;
using System.Threading;

namespace TestSQL
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
// Make SQL connection
Console.WriteLine("Connecting to SQL database
server...");
SqlConnection conn = new SqlConnection("CONNECT TIMEOUT=2;
SERVER=localhost; DATABASE=doomconnector; USER ID=codeimp;
PASSWORD=#########; ENCRYPT=false; POOLING=false;");
try { conn.Open(); }
catch(SqlException e)
{
Console.WriteLine("ERROR " + e.Number + ":
" + e.Message);
}
...
The output of this code:[quote:5608abe1e3]Connecting to SQL database
server...
ERROR 11: General network error. Check your network
documentation.[/quote:5608abe1e3]
Im using Windows 2000 Pro (completely up-to-date according to
www.windowsupdate.com).

I have installed the MySQL windows server on localhost and changed the
passwords as well as creating that "codeimp" account with all
privileges. I can login to that using the mysql console application
and perform operations without problems.

I have installed MDAC 2.8, no problems.

Using the Data Sources (ODBC) from the control panel, I am unable to
add a User DSN with the same settings (gives me the same error). I
have tried many different settings down to the most stupid things
like trying 127.0.0.1 instead of 'localhost', but nothing got any
better.

My network is fine and its on localhost so that shouldnt matter.
TCP/IP protocols installed and work fine as you can see, because I
can make this post.

I read some KB articles that talk about errors with this description
but they did not apply to my problem here.

What could this be? What should I do now? Help me please :)

Nov 16 '05 #1
4 1775

"CodeImp" <gh*******@hotmail-dot-com.no-spam.invalid> wrote in message
news:41**********@Usenet.com...
A simple app I quickly wrote to try getting info from a database. Here
is the first part of its code. The rest of the code is irellevant.
using System;
using System.Data;
using System.Data.SqlClient; .. . . I have installed the MySQL windows server on localhost and changed the
passwords as well as creating that "codeimp" account with all


.. . .

System.Data.SqlClient is the provider for Microsoft Sql Server.

David
Nov 16 '05 #2
SqlClient is for Microsoft Sql Server Server only.

To connect to MySQL take a look at the following information
http://www.devhood.com/tutorials/tut...utorial_id=576
"CodeImp" <gh*******@hotmail-dot-com.no-spam.invalid> wrote in message
news:41**********@Usenet.com...
A simple app I quickly wrote to try getting info from a database. Here
is the first part of its code. The rest of the code is irellevant.
using System;
using System.Data;
using System.Data.SqlClient;
using System.Threading;

namespace TestSQL
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
// Make SQL connection
Console.WriteLine("Connecting to SQL database
server...");
SqlConnection conn = new SqlConnection("CONNECT TIMEOUT=2;
SERVER=localhost; DATABASE=doomconnector; USER ID=codeimp;
PASSWORD=#########; ENCRYPT=false; POOLING=false;");
try { conn.Open(); }
catch(SqlException e)
{
Console.WriteLine("ERROR " + e.Number + ":
" + e.Message);
}
...
The output of this code:[quote:5608abe1e3]Connecting to SQL database
server...
ERROR 11: General network error. Check your network
documentation.[/quote:5608abe1e3]
Im using Windows 2000 Pro (completely up-to-date according to
www.windowsupdate.com).

I have installed the MySQL windows server on localhost and changed the
passwords as well as creating that "codeimp" account with all
privileges. I can login to that using the mysql console application
and perform operations without problems.

I have installed MDAC 2.8, no problems.

Using the Data Sources (ODBC) from the control panel, I am unable to
add a User DSN with the same settings (gives me the same error). I
have tried many different settings down to the most stupid things
like trying 127.0.0.1 instead of 'localhost', but nothing got any
better.

My network is fine and its on localhost so that shouldnt matter.
TCP/IP protocols installed and work fine as you can see, because I
can make this post.

I read some KB articles that talk about errors with this description
but they did not apply to my problem here.

What could this be? What should I do now? Help me please :)

Nov 16 '05 #3
Ah thanks,.. so the server you use matters. I thought SQL is a query
language that many servers support in the same way. Bah, I guess
doing it through ODBC makes it a windows-only application, no?

Nov 16 '05 #4
"CodeImp" <gh*******@hotmail-dot-com.no-spam.invalid> wrote in message
news:41********@Usenet.com...
I thought SQL is a query language that many servers support in the same way.

It certainly is and, once you've made a connection to the particular
SQL-compliant RDBMS in question, you should be able to query it with
"standard" SQL. But you need to be able to make that connection in the first
place!
Bah, I guess doing it through ODBC makes it a windows-only application,

no?

No need to use ODBC any more - lots of RDBMS (including mySQL) provide
native .NET providers these days and, for those which don't, there is a very
good chance that an OleDb provider will exist.

This page will be of some help: http://www.connectionstrings.com/ It
describes where you can obtain native .NET providers for mySQL, including a
free one, and also documents how to construct your connection strings.
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: bigoxygen | last post by:
Hi. I am experiencing problems connecting to MSSQL. I'm not sure where to begin looking for the problem. I don't know if the problem is originating with PHP or MSSQL What should the host name...
0
by: maddunr | last post by:
Hi, I just installed PHP 4.3.9, MySQL 4.0.2 and PHPMyAdmin 2.6.0-pl3 on our intranet server (Win2k3 running IIS). I also have a similar setup on my local machine (http://localhost/phpmyadmin). ...
4
by: JA | last post by:
Hi, I am total newbie to SQL Server. My new host tells me I can connect through AccessXP or 2002. I have Access 2000. Can I not connect with that also? Thanks, JA
1
by: Dishaa V | last post by:
Hello I need to connect to an access db which is on the internet. I do know that URL of the same. its http://www.vallury.com/balance/bank.mdb. Its just a test db. How can I connect to that db...
12
by: Ann Marinas | last post by:
Hi all, I would like to ask for some help regarding separating the asp.net webserver and the sql server. I have created an asp.net application for a certain company. Initially, we installed...
3
by: Jeremy Dillinger | last post by:
I am trying to design a program that will use data from a MySQL database. Currently all the data is being used with PHP scripts from a website. I am also trying to build a software solution that...
5
by: Odd Bjørn Andersen | last post by:
I have installed DB2 9 Enterprise Edition on my laptop and created the sample database. Now I'm having truble connecting to the database from Command Editor. If I connect from Command Window it's...
0
by: schosch | last post by:
Hello @all, we're connecting from a DB2UDB V7 on Windows to a DB2UDB on AIX. We had no problems while the version on AIX was still V7, but after wie updated the AIX-Part to V8.1 FP13 we cannot...
0
by: =?Utf-8?B?QWxwZXIgQUtDQVlPWg==?= | last post by:
Hello, First of all I wish you a good day. My help request is about .NET asynchrounus socket communication. I have developed Server-Client Windows Forms .NET applications in VC++ .NET v2003. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.