Showing posts with label apps. Show all posts
Showing posts with label apps. Show all posts

Thursday, March 29, 2012

Console apps work for SA but no other user

Hi

My console applications work forSA and no other user. I can run the Stored procedures used in the console application from Query analyser when logged in with username/password that I am attempting to use for console applications. I am using SQL server authenication. User access permissions look ok in Enterprise Manager. Access is permit for my user.

Any suggestions?

Thanks

Permissions in SQL are much more than just access permit. You should also grant EXECUTE permssion for a stored procedure to a user if you want the user to execute the stored procedure; or you can create a role and add the user as member, then grant proper permissions to the role. To understand permissions related concepts in SQL, you can start from here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/acdata/ac_8_qd_03_8q2b.asp

sqlsql

console apps only work if user is SA

Hi

When I try to use a user other then SA my console apps don't work.

I can run the Stored Procedures used in console application from Query analyser when logged in with the username/password that
I'm attempting to use for the console applications.

Under Users in Enterprise Manager Database access is 'permit' for my user.

By the way my web application which uses the same user name and password as in console applications is working. I also have dts packages running using dtsexec accessing the database with the same user name and password and they work fine.

MDAC 2.8 SP2 on windows server 2003 spi

C:\Program Files\Microsoft SQL Server\80\Tools\Binn>ODBCPING.EXE -S xxx.xxx.xxx.xxx
-U myusername -P mypassword

CONNECTED TO SQL SERVER

ODBC SQL Server Driver Version: 03.86.1830

SQL Server Version: Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 23:18:38
Copyright (c) 1988-2003 Microsoft Corporation
Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 1)

If the connection is available then why is the adapter.fill method failing?

I tried it using a text sql statement and that doesn't work either.

The problem isn't database specific as I did a test .bat on Northwind sample database and got same 'general network error'

Here's the error:

apps\Exports>exporter.bat

Unhandled Exception: System.Data.SqlClient.SqlException: General network error.
Check your network documentation.
at System.Data.SqlClient.ConnectionPool.CreateConnection()
at System.Data.SqlClient.ConnectionPool.UserCreateRequest()
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransactio
n)
at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConn
ectionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, Conne
ctionState& originalState)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startR
ecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior be
havior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)

at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)

//Testing using SELECT statement as command text

D\Test>Test.bat

D:\Test>TestDBAccess.exe "server=xxx.xxx.xxx.xxx;uid=xxxx;pwd=xxx;
database=Northwind;"

Unhandled Exception: System.Data.SqlClient.SqlException: General network error.
Check your network documentation.
at System.Data.SqlClient.ConnectionPool.CreateConnection()
at System.Data.SqlClient.ConnectionPool.UserCreateRequest()
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransactio
n)
at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConn
ectionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()

D:\Test>

Any ideas/help much appreciated!

Hi,

would be cool if you could show us your code.Sometimes people hardcode certain properties (I confess that I did that on my own one time :-) ) which will lead to an error where usally there shouldn′t be an error (especially in console apps where connection properties are passed via arguments which isn′t testable while debugging within VS)

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||

Hi,

Here's the essentials of the code (without some try catch statements).

Thanks.

KH

.bat file

::arg 0 Connection String
::arg 1 Export Path //just a path where I want the output file to go


Exporter.exe "server=xxx.xxx.xxx.xxx;uid=username;pwd=password;database=DATABASENAME;" "d:\\xxx\\xxx\\ExportOut\\"


Source code


using System;

using System.Data;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
using System.Configuration;
using System.Data.SqlClient;
using System.IO;


namespace Exporter
{
class Export
{

private static String ConnectionString;

private static String ExportPath;

private static StreamWriter ExportLog;

[STAThread]
static void Main(string[] args)
{

ConnectionString = args[0];

ExportPath = args[1];

String DateString = System.DateTime.Today.Day.ToString() + "_" + System.DateTime.Today.Month.ToString();

ExportLog = new StreamWriter(ExportPath+"Export_Log_"+DateString+".txt");

DoExport();

ExportLog.Close();

}

private static void DoExport()
{

ExportLog.WriteLine("Beginning export");
GetData());


}



private static void GetData()
{


SqlCommand SelectCommand = new SqlCommand();

SelectCommand.CommandType=(System.Data.CommandType.StoredProcedure);

SelectCommand.CommandText="GetCSVOutput";

SqlConnection Conn = new SqlConnection(ConnectionString);

SelectCommand.Connection=Conn;



SqlDataAdapter ReportAdapter = new SqlDataAdapter();

FaultReportAdapter.SelectCommand=SelectCommand;

DataSet ReportData = new DataSet();


ReportAdapter.Fill(ReportData,"Report");

if (ReportData.Tables["Report"].Rows.Count == 0)
{
Conn.Close();
ExportLog.WriteLine("No reports to export");
return false;

}
else
{
Conn.Close();
return MakeFile(ReportData);

}

}


private static void MakeFile(DataSet FaultReportData)
{


/* Just prints out the results of Stored procedure to file and closes file */




}


|||Hi,

beside that the FaultReportDapater doesn′t exists (but I guess this is just a typo) you can try disabling the connection pool to see if it is based on this with adding the keywords "Pooling=False" to the connecting string.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de
|||

Hi,

Yes that was just a typo. With pooling set to false I still get the same error.

Thanks

KH

|||

What is the call stack of the exception if you disable pooling?

|||

Here's the call stack with pooling set to false.

D:\apps\Export>exporter.bat

D:\content\apps>Exporter.exe "server=xxx.xxx.xxx.xxx;uid=xxxx;pwd=;database=xxxx;pooling=False" "d:\\Content\\xxxx\\ExportOut\\"

Unhandled Exception: System.Data.SqlClient.SqlException: General network error.
Check your network documentation.
at System.Data.SqlClient.SqlInternalConnection.OpenAndLogin()
at System.Data.SqlClient.SqlInternalConnection..ctor(SqlConnection connection
, SqlConnectionString connectionOptions)
at System.Data.SqlClient.SqlConnection.Open()
at System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, Conne
ctionState& originalState)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startR
ecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior be
havior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord,
Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)

at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable)
at Exporter.Export.GetData() in
\\xxxx\dotnet_dll_production
\xxxx\xxxxx\export.cs:line 536
at Exporter.Export.DoExport() in
\\xxxx\dotnet_dll_production\xxxx\xxxx\export.cs:line 143
at Exporter.Export.Main(String[] args) in \\xxxx\dotnet_dll_produc
tion\xxxx\xxxx\export.cs:line 95

D:\apps\Export>

Tuesday, March 20, 2012

Connections to SQL Server

I have been developing an Intranet for the past few months, and now that I
have developed about 4 apps, I am questioning my connection string. We have
a Windows 2000 Server with SQL Server 2000 and are using Integrated Auth. so
that people don't have to login to the sql server.
Here is my current connection string,
MM_CliCore_STRING = "Provider=SQLOLEDB.1;Trusted_Connection=Yes;Data
Source=swvtc06;Initial Catalog=CliCore;"
As you can see I am using Trusted Connection, which is the only way that I
could get this connection to work. If I remove the trusted connection info,
it doesn't work at all.
How should I go about setting this up? Why is using trusted connection such
a bad idea? It seems to work, if someone doesn't have permission, it
doesn't let them into the db. And, what are the other ways of doing this?
Thanks,
Drew LaingHi Drew,
Your connection should read as follows:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False
I use this string in a delphi ado connection component to set up a trusted c
onnection to my database server.
Regards,
Ruud Aalders
quote:
Originally posted by Drew
I have been developing an Intranet for the past few months, and now that I
have developed about 4 apps, I am questioning my connection string. We have
a Windows 2000 Server with SQL Server 2000 and are using Integrated Auth. so
that people don't have to login to the sql server.
Here is my current connection string,
MM_CliCore_STRING = "Provider=SQLOLEDB.1;Trusted_Connection=Yes;Data
Source=swvtc06;Initial Catalog=CliCore;"
As you can see I am using Trusted Connection, which is the only way that I
could get this connection to work. If I remove the trusted connection info,
it doesn't work at all.
How should I go about setting this up? Why is using trusted connection such
a bad idea? It seems to work, if someone doesn't have permission, it
doesn't let them into the db. And, what are the other ways of doing this?
Thanks,
Drew Laing

Connections to SQL Server

I have been developing an Intranet for the past few months, and now that I
have developed about 4 apps, I am questioning my connection string. We have
a Windows 2000 Server with SQL Server 2000 and are using Integrated Auth. so
that people don't have to login to the sql server.
Here is my current connection string,
MM_CliCore_STRING = "Provider=SQLOLEDB.1;Trusted_Connection=Yes;Data
Source=swvtc06;Initial Catalog=CliCore;"
As you can see I am using Trusted Connection, which is the only way that I
could get this connection to work. If I remove the trusted connection info,
it doesn't work at all.
How should I go about setting this up? Why is using trusted connection such
a bad idea? It seems to work, if someone doesn't have permission, it
doesn't let them into the db. And, what are the other ways of doing this?
Thanks,
Drew LaingHi Drew,
Your connection should read as follows:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Securit
Info=False
I use this string in a delphi ado connection component to set up
trusted connection to my database server.
Regards,
Ruud Aalders
Drew wrote:
> *I have been developing an Intranet for the past few months, and no
> that I
> have developed about 4 apps, I am questioning my connection string.
> We have
> a Windows 2000 Server with SQL Server 2000 and are using Integrate
> Auth. so
> that people don't have to login to the sql server.
> Here is my current connection string,
> MM_CliCore_STRING = "Provider=SQLOLEDB.1;Trusted_Connection=Yes;Data
> Source=swvtc06;Initial Catalog=CliCore;"
> As you can see I am using Trusted Connection, which is the only wa
> that I
> could get this connection to work. If I remove the truste
> connection info,
> it doesn't work at all.
> How should I go about setting this up? Why is using truste
> connection such
> a bad idea? It seems to work, if someone doesn't have permission
> it
> doesn't let them into the db. And, what are the other ways of doin
> this?
> Thanks,
> Drew Laing
-
Ruud Aalder
----
Posted via http://www.webservertalk.co
----
View this thread: http://www.webservertalk.com/message462636.htm

Connections to SQL Server

I have been developing an Intranet for the past few months, and now that I
have developed about 4 apps, I am questioning my connection string. We have
a Windows 2000 Server with SQL Server 2000 and are using Integrated Auth. so
that people don't have to login to the sql server.
Here is my current connection string,
MM_CliCore_STRING = "Provider=SQLOLEDB.1;Trusted_Connection=Yes;Da ta
Source=swvtc06;Initial Catalog=CliCore;"
As you can see I am using Trusted Connection, which is the only way that I
could get this connection to work. If I remove the trusted connection info,
it doesn't work at all.
How should I go about setting this up? Why is using trusted connection such
a bad idea? It seems to work, if someone doesn't have permission, it
doesn't let them into the db. And, what are the other ways of doing this?
Thanks,
Drew Laing
Hi Drew,
Your connection should read as follows:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security
Info=False
I use this string in a delphi ado connection component to set up a
trusted connection to my database server.
Regards,
Ruud Aalders
Drew wrote:
> *I have been developing an Intranet for the past few months, and now
> that I
> have developed about 4 apps, I am questioning my connection string.
> We have
> a Windows 2000 Server with SQL Server 2000 and are using Integrated
> Auth. so
> that people don't have to login to the sql server.
> Here is my current connection string,
> MM_CliCore_STRING = "Provider=SQLOLEDB.1;Trusted_Connection=Yes;Da ta
> Source=swvtc06;Initial Catalog=CliCore;"
> As you can see I am using Trusted Connection, which is the only way
> that I
> could get this connection to work. If I remove the trusted
> connection info,
> it doesn't work at all.
> How should I go about setting this up? Why is using trusted
> connection such
> a bad idea? It seems to work, if someone doesn't have permission,
> it
> doesn't let them into the db. And, what are the other ways of doing
> this?
> Thanks,
> Drew Laing *
Ruud Aalders
Posted via http://www.webservertalk.com
View this thread: http://www.webservertalk.com/message462636.html
sqlsql

Saturday, February 25, 2012

Connection Time is too long

I'm using ado to connect to a sql server 2000, and suddendly the line that
does the connection (conx.open) is taking a long time. All the apps that
connecto to the server take a long time also. Additionally, when you use the
sql manager, when you retrieve the rows from a table it takes a long time. It
is not a network problem, because we have pretty good speed in our network.
It's something to do with the sql server, but I have not figure out what is
it. I cheked the current activity in the server, and doesn't have a lot of
processes running and half of them are sleeping.
any ideas how to solve this issue?
Thanks
If you connect on the actual SQL Server is there an issue? If not, then you
are looking at an application server or network issue.
"Adal" <Adal@.discussions.microsoft.com> wrote in message
news:5287E88B-270C-4A92-8FF6-2F1E0A252A64@.microsoft.com...
> I'm using ado to connect to a sql server 2000, and suddendly the line that
> does the connection (conx.open) is taking a long time. All the apps that
> connecto to the server take a long time also. Additionally, when you use
the
> sql manager, when you retrieve the rows from a table it takes a long time.
It
> is not a network problem, because we have pretty good speed in our
network.
> It's something to do with the sql server, but I have not figure out what
is
> it. I cheked the current activity in the server, and doesn't have a lot of
> processes running and half of them are sleeping.
> any ideas how to solve this issue?
> Thanks
|||Hi, I went to the SQL server, and worked directly on it, with the enterprise
manager, and it seem to me that the time to retrieve the information from
tables was still a little high. I still have to wait long time to get a
connection to sql from ado. But, as I said before, this is not all the time,
is every minute or so. I don't think it has anything to do with ado or
connection poolin, because when I work with enterprise manager and retrieve
information from tables, it sometimes takes longer to retrieve the
information, no matter how many rows does it have.
thanks

Connection Time is too long

I'm using ado to connect to a sql server 2000, and suddendly the line that
does the connection (conx.open) is taking a long time. All the apps that
connecto to the server take a long time also. Additionally, when you use the
sql manager, when you retrieve the rows from a table it takes a long time. I
t
is not a network problem, because we have pretty good speed in our network.
It's something to do with the sql server, but I have not figure out what is
it. I cheked the current activity in the server, and doesn't have a lot of
processes running and half of them are sleeping.
any ideas how to solve this issue?
ThanksIf you connect on the actual SQL Server is there an issue? If not, then you
are looking at an application server or network issue.
"Adal" <Adal@.discussions.microsoft.com> wrote in message
news:5287E88B-270C-4A92-8FF6-2F1E0A252A64@.microsoft.com...
> I'm using ado to connect to a sql server 2000, and suddendly the line that
> does the connection (conx.open) is taking a long time. All the apps that
> connecto to the server take a long time also. Additionally, when you use
the
> sql manager, when you retrieve the rows from a table it takes a long time.
It
> is not a network problem, because we have pretty good speed in our
network.
> It's something to do with the sql server, but I have not figure out what
is
> it. I cheked the current activity in the server, and doesn't have a lot of
> processes running and half of them are sleeping.
> any ideas how to solve this issue?
> Thanks|||Hi, I went to the SQL server, and worked directly on it, with the enterprise
manager, and it seem to me that the time to retrieve the information from
tables was still a little high. I still have to wait long time to get a
connection to sql from ado. But, as I said before, this is not all the time,
is every minute or so. I don't think it has anything to do with ado or
connection poolin, because when I work with enterprise manager and retrieve
information from tables, it sometimes takes longer to retrieve the
information, no matter how many rows does it have.
thanks

Sunday, February 19, 2012

Connection String Error

Hi Team

I am new to WEB sites as I normal work with Win apps.

I am using Server 2003 with SQL server 2005 Delevoper.

The server is on my own network in the same room..

I have made a new Web Site in Visual Studio 2005 DotNet Framework 2.0. It runs fine on testing.

I can log in and move around just fine. BUT when I publish it to the server the following happens:

I Can find the web site in internet explore from my Domain name (www.rbsoft.com.au) or Static IP. I get the default page up ok.

Then when I click on login I will get the login page. So I fill it in and click Login.

Then I get the follwing Error message.

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)

The Connection string is as follows:

<connectionStrings>

<add name="ConnectionString" connectionString="Data Source=RBSOFT-SERVER\MSSQLSERVER;AttachDbFilename=\App_Date\ASPNETDB.MDF;Integrated Security=True;User Instance=True" providerName="System.Data.SqlClient"/>

</connectionStrings>

I seems to me that the web site can not find the ASPNETDB.MDF database.

I can see the database on the server with "SQL Server Management Studio Express"

I spent many hours trying to find out why it will not work.

Can any one help me - Please

Regards

Ron B

please check spelling of \App_Date\*.mdf
DatE or Data