Showing posts with label direct. Show all posts
Showing posts with label direct. Show all posts

Wednesday, March 21, 2012

No access from Application to SQL Server 2005 - Solved

Hi

I have installed the 2005 SQL Server and its up running. I can connect to the database direct as administrator, but my simple test application returns an exception.

SqlConnection con = new SqlConnection("server=mercur\\sqlserver2005,database=AdventureWorks;integrated security=true");

con.Open();

As the output confirms it might be the default settings. Im not familiar with the enviroment and will appreciate your help.

Mosquito

I receive this exception:

System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)

at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)

at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)

at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)

at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)

at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)

at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)

at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)

at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

at System.Data.SqlClient.SqlConnection.Open()

at HelloWorld.Form1.button1_Click(Object sender, EventArgs e) in D:\Visual Studio 2005\Projects\HelloWorld\HelloWorld\Form1.cs:line 26

The reason is given in the Exception. The connection string is not valid.

The separation between server string and database string has to be a semicolon and everything works just fine.

No access from Application to SQL Server 2005

Hi

I have installed the 2005 SQL Server and its up running. I can connect to the database direct as administrator, but my simple test application returns an exception.

SqlConnection con = new SqlConnection("server=mercur\\sqlserver2005,database=AdventureWorks;integrated security=true");

con.Open();

As the output confirms it might be the default settings. Im not familiar with the enviroment and will appreciate your help.

Mosquito

I receive this exception:

System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)

at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)

at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)

at System.Data.SqlClient.TdsParser.Connect(Boolean& useFailoverPartner, Boolean& failoverDemandDone, String host, String failoverPartner, String protocol, SqlInternalConnectionTds connHandler, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity, SqlConnection owningObject, Boolean aliasLookup)

at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)

at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)

at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)

at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)

at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)

at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)

at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)

at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

at System.Data.SqlClient.SqlConnection.Open()

at HelloWorld.Form1.button1_Click(Object sender, EventArgs e) in D:\Visual Studio 2005\Projects\HelloWorld\HelloWorld\Form1.cs:line 26

The reason is given in the Exception. The connection string is not valid.

The separation between server string and database string has to be a semicolon and everything works just fine.

No access from Application to SQL Server 2000

I have installed the SQL Server 2000 and its up running.

I can connect to the database direct as administrator, but my test application(asp.net 2.0) returns an exception.

SqlConnection sqlConn = new SqlConnection("data source=10.61.90.24;initial catalog=testdb;persist security info=False;user id=sa;pwd=data;Type System Version=SQL Server 2000;");

sqlConn.Open();

I receive this exception:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

This is a configuration problem. You need to go into the 'SQL Server Configuration' tool and enable Named Pipes.

Regards

Paul.

|||

I have enabled Named Pipes.The connection is still failed.

thanks.

Wednesday, March 7, 2012

Newbie?: Can This Be Done?- If so please direct

Hello NG
I have been working with Access for a Long Time - Am just now starting
to get my feet wet with SQL Server 2000 - We have a production database that
we have moved the tables to SQLServer and I have been creating stored
procedures to replicate some of the processes done on the access side - the
server does process extremely faster than access - Here is my problem I am
currently pulling info from SQL SERVER to Access once a w for wly
stats I want to create a stored procedure to process the wly stats and
push them to an access table upon request - we have multiple warehouses and
i would like to have the process coded once in sql and dump to the access
table based off a warehouse variable passed to the stored procedure - Can
SQLServer from a stored procedure export a recordset into a varible defined
Access Table?
TIAFAH
RandyIt sounds like DTS is what you're looking for. I don't know that I
would recommend this approach to an experienced SQL Server developer
because of its limitations, but in what you're asking for, it seems
ideal. Open Enterprise Manager, right-click your database, select
"Export Data" (it might be under a submenu), follow the wizard. I'm
pretty sure you can specify a stored procedure for the source. If I
remember correctly, you may also schedule the package to run at
intervals.
-Alan
Randy wrote:
> Hello NG
> I have been working with Access for a Long Time - Am just now starting
> to get my feet wet with SQL Server 2000 - We have a production database th
at
> we have moved the tables to SQLServer and I have been creating stored
> procedures to replicate some of the processes done on the access side - th
e
> server does process extremely faster than access - Here is my problem I am
> currently pulling info from SQL SERVER to Access once a w for wly
> stats I want to create a stored procedure to process the wly stats and
> push them to an access table upon request - we have multiple warehouses an
d
> i would like to have the process coded once in sql and dump to the access
> table based off a warehouse variable passed to the stored procedure - Can
> SQLServer from a stored procedure export a recordset into a varible define
d
> Access Table?
> TIAFAH
> Randy