Showing posts with label app. Show all posts
Showing posts with label app. Show all posts

Sunday, March 25, 2012

Connection pools constantly grow

I've got a little console app that basically pulls back a recordset from our SQL Server 2005, goes through each row in the dataset and may/may not insert a record into a different table in the database. We use sproc's for every transaction and I close every connection in the application. However, when the application ends, I still show connection pools open in the performance monitor. Same with websites that I know have no traffic or that have been stopped by me in IIS.

Last night I showed a total of 6000+ "Current # pooled and nonpooled connections". Should I be worried about what seems to be unending growth in the connection pools? If so, how can I look to manage this better?

Check the following article:

http://www.15seconds.com/Issue/040830.htm

Regards

|||

I actually read that article yesterday.

Perhaps I'm dealing with a connection leak. If so, I don't know how. All my transactions are either handled via:

Try SqlConnection.Open() SqlCommand.ExecuteNonQuery()Finally SqlConnection.Close()End Try

Or

Try SqlDataAdapter.Fill(DataSet,"Results")
Finally
If SqlConnection.State = ConnectionState.OpenThen SqlConnection.Close()End If
End Try

My program uses two databases, which means that there are two connections strings. That accounts for the reason the program creates 2 connection pools when it runs, but why aren't those pools closed when the program finishes? Next time the program runs, it's increased by 2 again.

sqlsql

connection pooling problem w/ ASP.NET 2.0 and SQL 2005 64 bit?

Here's the gist of the problem I am having:
I just deployed my new ASP.NET 2.0 / C# web app to "production". I have a
web server running Windows 2003, all the latest updates, etc. As mentioned,
the web app is running under ASP.NET 2 and C3. On a separate server, I am
running SQL Server 2005 64 bit, Standard Edition (SP1).
Note, I have separate development and test environments that mimic the above
setup. That is I have a dev web server accessing a separate dev database
server; the only difference is that the db server is SQL 2005 32 bit, Std
Edition; same in test.
My production web app is experiencing connection pooling problems. If I
bring up the activity monitor on the production db server while I am
exercising some of the web pages, I can watch the connections grow to the
100 max (the default for asp.net) very quickly (just one person hitting a
page that exercises a database query) and then the .NET app will eventually
throw an error:
Message: Timeout expired. The timeout period elapsed prior to obtaining a
connection from the pool. This may have occurred because all pooled
connections were in use and max pool size was reached.
Source: System.Data...
Some things to consider:
1) Before everyone jumps to the conclusion about datareaders, please bear in
mind that the EXACT same .NET code is on dev and test web servers; I am NOT
able to get the connections to max out on dev or test; whereas on production
web server, I can easily get it to max out. It's not a code issue. Yes, I
know all about closing DataReader connections explicitly, blah, blah. It's
not the code.
2) There are 2 major difference on the db server; however
a) the production server is 64 bit; my other db servers are 32 bit
b) I actually spent quite a bit of time today on my production db server in
an effort to get linked server stuff working. So, there are some definite
things I did on the prod server db that I have *not* done on dev or test sql
boxes, such as
- turning on MS DTC security config settings (in Component Services); there
are many MS blogs about this and the following MSKB:
http://support.microsoft.com/kb/899191
- enabling named pipes
So, I'm thinking I have 2 straws to grasp at:
A) call Microsoft tech support to see if there's anything that google hasn't
turned up
B) uninstall SQL Server 2005 on my production db server and reinstall using
a 32 bit version. Of course, since this is production. I bought 64 bit SQL,
so would I be "allowed" to downgrade to 32 bit? The only additional disc
media I have are MSDN discs.Hi,
Thanks for using Microsoft Managed Newsgroup.
From your description, I understand that:
Your ASP.NET 2.0 web application with SQL Server 2005 64 bit SP1 was
running on a production environment. The database server was on a separated
machine. You found that the connections grew quickly to reach the max
connection limit on your SQL Server and then any new connecion was timeout.
However no problem appeared on your test and development environment.
If I have misunderstood, please let me know.
For further research, I would like your answering me several questions:
1. How long had the SQL Server been normally running before the problem
appeared?
2. What are the situations of CPU and memory usage at that time?
3. Could you see some errors in the Event logs?
Also, I would like to collect the following information from you:
1. MPSReport:
Please help create a MPSReport on the problematic machine, which will
collect
ERRORLOG, Windows event log and other helpful information about the SQL
Server. To
create a MPSReport, please visit the following web site:
<http://www.microsoft.com/downloads/details.aspx?FamilyId=CEBF3C7C-7CA5-408F
-88B7-F9
C79B7306C0&displaylang=en>.
And look for MPSRPT_SQL.EXE. Download it and run it on the machine. Dismiss
the
prompted dialog boxes and the readme window (usually a Notepad) after you
read
them. After the Command Prompt window closes itself, collect the cab file
the tool
has generated and sent it to me.
2. SQL Error log:
By default, they are located at: C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\LOG -- Send all the files under this folder with zip
format to me.
3. Server Configurations:
Use sqlcmd or osql to run the following batch and send the output file to
me:
Under command prompt: sqlcmd -S ServerName\InstanceName -E -o C:\output.txt
exec sp_configure 'show advanced', 1
reconfigure with override
exec sp_configure
go
4. SQL Trace file
Use SQL Profiler to monitor your SQL Server to see what are the SQLs or SPs
being executed at that time.
I will create a web file space for your uploading the large files. However
you may need to leave me your email so that I can mail you the password.
If it is not convenient for you to leave your email here, you can send an
email to me (changliw@.microsoft.com).
Note: Our managed newsgroup is focused on break/fix issues that are neither
urgent nor complex. If the issue is urgent to your business, it is
recommended that you contact Microsoft Customer Support Services (CSS) via
telephone so that a dedicated Support Professional can assist you in a more
efficient manner. Please be advised that contacting phone support will be a
charged call.
To obtain the phone numbers for specific technology request please take a
look at the web site listed below.
http://support.microsoft.com/default.aspx?scid=fh;EN-US;PHONENUMBERS
If you are outside the US please see http://support.microsoft.com for
regional support phone numbers.
Sincerely yours,
Charles Wang
Microsoft Online Community Support
======================================================When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================|||Hi,
Just check with you to see if you need further assistance on this issue.
We appreciate your posting back at your convenience and let us know the
issue status.
If you have any other questions or concerns, please feel free to let us
know. It is always our pleasure to be of assistance.
Charles Wang
Microsoft Online Community Support

Connection pooling problem

Can anybody help me to solve this problem

I have a web application. In this app i have one class genral for database transections. I create new object of this class on every page in page load event & dispose it on UnLoad event. After sometime this app gives connection pooling exception.

Means connection are not closed, but i disposed the object like

tmpDatabase.Dispose()
tmpDatabase = Nothing

Plz can anybody tell me the mistake i m doing.

ThanxPersonally, I would contruct the object as late as possible (where needed) and destroy the object as soon as possible, and let connection pooling work as designed.

Perhaps there is som error condition that you are not handling, so that the dispose is sometimes not reached.|||I can see using Break point, it destroying the object. Means cursor reaching to the line where the object is destroyed.|||Please Help me

This is big problem for my application. I dont know what i doing wrong.|||"This is big problem for my application. I dont know what i doing wrong."

We do not either. In general, there is some reason why your connections are not being closed. Could be an error condition not properly handled, could be a design problem. Absent seeing much of the code, and absent you taking my advice to make the Open and Close very close to each other, leaving the connection open for as short a time as possible rather than creating one for a page load/unload cycle, I do not think anyone can help you.

Thursday, March 22, 2012

connection pool problem using in Tomcat

I use "SQL Server 2000 Driver for JDBC SP3" to connect SQLServer2000 under
Tomcat App server.
I wish to control the number of physical connections made to the database to
50. Can somebody guide me about this.
At the moment even with as low as 30 concurrent hits we see a very high
number of phyiscal connection to the database as high as 200.
I am using the following settings in SERVER.XML
<Resource name="jdbc/ECTDB" auth="Container"
type="com.microsoft.jdbcx.sqlserver.SQLServerDataS ource"/>
<ResourceParams name="jdbc/ECTDB">
<parameter><name>maxActive</name><value>30</value></parameter>
<parameter><name>maxIdle</name><value>20</value></parameter>
<parameter><name>maxWait</name><value>10000</value></parameter>
<parameter><name>factory</name><value>com.microsoft.jdbcx.sqlserver.SQLServe rDataSourceFactory</value></parameter>
<parameter><name>driverClassName</name><value>com.microsoft.jdbcx.sqlserver.SQLServe rDataSource</value></parameter>
<parameter><name>user</name><value>..</value></parameter>
<parameter><name>password</name><value>..</value></parameter>
<parameter><name>driverName</name><value>SQLServer</value></parameter>
<parameter><name>serverName</name><value>127.0.0.1</value></parameter>
<parameter><name>portNumber</name><value>1433</value></parameter>
<parameter><name>databaseName</name><value>..</value></parameter>
<parameter><name>selectMethod</name><value>cursor</value></parameter>
<parameter><name>loginTimeout</name><value>60</value></parameter>
</ResourceParams>
Thanks a lot
| Thread-Topic: connection pool problem using in Tomcat
| thread-index: AcSMuy5kABS/93PSRZ6MtRi1273r1w==
| X-WBNR-Posting-Host: 202.134.106.86
| From: "=?Utf-8?B?a2FpY2FsbA==?=" <kaicall@.discussions.microsoft.com>
| Subject: connection pool problem using in Tomcat
| Date: Fri, 27 Aug 2004 21:55:03 -0700
| Lines: 30
| Message-ID: <22AD57F5-91A6-48C5-81BF-F9B84365D03F@.microsoft.com>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.sqlserver.jdbcdriver
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
| Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: cpmsftngxa10.phx.gbl microsoft.public.sqlserver.jdbcdriver:6282
| X-Tomcat-NG: microsoft.public.sqlserver.jdbcdriver
|
| I use "SQL Server 2000 Driver for JDBC SP3" to connect SQLServer2000
under
| Tomcat App server.
|
| I wish to control the number of physical connections made to the database
to
| 50. Can somebody guide me about this.
|
| At the moment even with as low as 30 concurrent hits we see a very high
| number of phyiscal connection to the database as high as 200.
| I am using the following settings in SERVER.XML
| <Resource name="jdbc/ECTDB" auth="Container"
| type="com.microsoft.jdbcx.sqlserver.SQLServerDataS ource"/>
| <ResourceParams name="jdbc/ECTDB">
| <parameter><name>maxActive</name><value>30</value></parameter>
| <parameter><name>maxIdle</name><value>20</value></parameter>
| <parameter><name>maxWait</name><value>10000</value></parameter>
<parameter><name>factory</name><value>com.microsoft.jdbcx.sqlserver.SQLServe
rDataSourceFactory</value></parameter>
<parameter><name>driverClassName</name><value>com.microsoft.jdbcx.sqlserver.
SQLServerDataSource</value></parameter>
| <parameter><name>user</name><value>..</value></parameter>
| <parameter><name>password</name><value>..</value></parameter>
| <parameter><name>driverName</name><value>SQLServer</value></parameter>
| <parameter><name>serverName</name><value>127.0.0.1</value></parameter>
| <parameter><name>portNumber</name><value>1433</value></parameter>
| <parameter><name>databaseName</name><value>..</value></parameter>
| <parameter><name>selectMethod</name><value>cursor</value></parameter>
| <parameter><name>loginTimeout</name><value>60</value></parameter>
| </ResourceParams>
|
|
| Thanks a lot
|
|
If you are using SelectMethod=direct, then it is possible that you are
seeing an increase in connections due to the creation of cloned
connections. These additional connections are necessary because each
statement requires its own connection. Your Tomcat settings have no
bearing on this particular behavior, as it is inherent in the JDBC driver
itself.
Are you using transactions in your code? Can you provide code that
reproduces the problem behavior?
Carb Simien, MCSE MCDBA MCAD
Microsoft Developer Support - Web Data
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
Are you secure? For information about the Strategic Technology Protection
Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.
|||Carb Simien ,
Yes, I use connection in my code and use a following function for getting
conncection.
public static Connection getConnection() throws Exception {
Connection dbConnection = null;
InitialContext ctx = new InitialContext();
Context envCtx = (Context) ctx.lookup("java:comp/env");
ConnectionPoolDataSource ds =
(ConnectionPoolDataSource) envCtx.lookup("jdbc/ECTDB");
Connection conn = ds.getPooledConnection().getConnection();
conn.setAutoCommit(false);
return conn;
}
Is this funciton cause the problem?
Thanks a lot.
kaicall
""Carb Simien [MSFT]"" wrote:

> --
> | Thread-Topic: connection pool problem using in Tomcat
> | thread-index: AcSMuy5kABS/93PSRZ6MtRi1273r1w==
> | X-WBNR-Posting-Host: 202.134.106.86
> | From: "=?Utf-8?B?a2FpY2FsbA==?=" <kaicall@.discussions.microsoft.com>
> | Subject: connection pool problem using in Tomcat
> | Date: Fri, 27 Aug 2004 21:55:03 -0700
> | Lines: 30
> | Message-ID: <22AD57F5-91A6-48C5-81BF-F9B84365D03F@.microsoft.com>
> | MIME-Version: 1.0
> | Content-Type: text/plain;
> | charset="Utf-8"
> | Content-Transfer-Encoding: 7bit
> | X-Newsreader: Microsoft CDO for Windows 2000
> | Content-Class: urn:content-classes:message
> | Importance: normal
> | Priority: normal
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
> | Newsgroups: microsoft.public.sqlserver.jdbcdriver
> | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.1.29
> | Path: cpmsftngxa10.phx.gbl!TK2MSFTNGXA03.phx.gbl
> | Xref: cpmsftngxa10.phx.gbl microsoft.public.sqlserver.jdbcdriver:6282
> | X-Tomcat-NG: microsoft.public.sqlserver.jdbcdriver
> |
> | I use "SQL Server 2000 Driver for JDBC SP3" to connect SQLServer2000
> under
> | Tomcat App server.
> |
> | I wish to control the number of physical connections made to the database
> to
> | 50. Can somebody guide me about this.
> |
> | At the moment even with as low as 30 concurrent hits we see a very high
> | number of phyiscal connection to the database as high as 200.
> | I am using the following settings in SERVER.XML
> | <Resource name="jdbc/ECTDB" auth="Container"
> | type="com.microsoft.jdbcx.sqlserver.SQLServerDataS ource"/>
> | <ResourceParams name="jdbc/ECTDB">
> | <parameter><name>maxActive</name><value>30</value></parameter>
> | <parameter><name>maxIdle</name><value>20</value></parameter>
> | <parameter><name>maxWait</name><value>10000</value></parameter>
> <parameter><name>factory</name><value>com.microsoft.jdbcx.sqlserver.SQLServe
> rDataSourceFactory</value></parameter>
> <parameter><name>driverClassName</name><value>com.microsoft.jdbcx.sqlserver.
> SQLServerDataSource</value></parameter>
> | <parameter><name>user</name><value>..</value></parameter>
> | <parameter><name>password</name><value>..</value></parameter>
> | <parameter><name>driverName</name><value>SQLServer</value></parameter>
> | <parameter><name>serverName</name><value>127.0.0.1</value></parameter>
> | <parameter><name>portNumber</name><value>1433</value></parameter>
> | <parameter><name>databaseName</name><value>..</value></parameter>
> | <parameter><name>selectMethod</name><value>cursor</value></parameter>
> | <parameter><name>loginTimeout</name><value>60</value></parameter>
> | </ResourceParams>
> |
> |
> | Thanks a lot
> |
> |
> If you are using SelectMethod=direct, then it is possible that you are
> seeing an increase in connections due to the creation of cloned
> connections. These additional connections are necessary because each
> statement requires its own connection. Your Tomcat settings have no
> bearing on this particular behavior, as it is inherent in the JDBC driver
> itself.
> Are you using transactions in your code? Can you provide code that
> reproduces the problem behavior?
> Carb Simien, MCSE MCDBA MCAD
> Microsoft Developer Support - Web Data
> Please reply only to the newsgroups.
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Are you secure? For information about the Strategic Technology Protection
> Program and to order your FREE Security Tool Kit, please visit
> http://www.microsoft.com/security.
>
|||CarbinoS@.online.microsoft.com ("Carb Simien [MSFT]") wrote in message news:<zzuzMF7jEHA.2516@.cpmsftngxa10.phx.gbl>...
> If you are using SelectMethod=direct, then it is possible that you are
> seeing an increase in connections due to the creation of cloned
> connections. These additional connections are necessary because each
> statement requires its own connection. Your Tomcat settings have no
> bearing on this particular behavior, as it is inherent in the JDBC driver
> itself.
> Are you using transactions in your code? Can you provide code that
> reproduces the problem behavior?
> Carb Simien, MCSE MCDBA MCAD
> Microsoft Developer Support - Web Data
> Please reply only to the newsgroups.
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Are you secure? For information about the Strategic Technology Protection
> Program and to order your FREE Security Tool Kit, please visit
> http://www.microsoft.com/security.
This is a little scary isn't it? If I have a J2EE app that starts out
pre-preparing (for subsequent re-use) N prepared statements per
connection and I have M concurrent clients using the app then we'll
require N*M physical database connections. Is that correct? That
number could be pretty huge for even a mid size app..
Is there any plans to address this in any future driver?
Grant M
|||grantmitchell7@.yahoo.com wrote:

> CarbinoS@.online.microsoft.com ("Carb Simien [MSFT]") wrote in message news:<zzuzMF7jEHA.2516@.cpmsftngxa10.phx.gbl>...
>
> This is a little scary isn't it? If I have a J2EE app that starts out
> pre-preparing (for subsequent re-use) N prepared statements per
> connection and I have M concurrent clients using the app then we'll
> require N*M physical database connections. Is that correct? That
> number could be pretty huge for even a mid size app..
Not to mention if you plan to do anything transactionally, or use temp tables,
which would be limited to one real connection, and not involve all the
under-the-covers connections involved in one logical connection.
I am confident that an upcoming version of the free MS driver will
address this. In the mean time you have the option of using commercial
drivers, or ensuring you run with selectMethod=cursor. As I recall, the
original poster actually already showed he was running with selectMethod=cursor...
Joe Weinstein at BEA
> Is there any plans to address this in any future driver?
> Grant M
|||Joe Weinstein <joeNOSPAM@.bea.com> wrote in message news:<4136035E.9000108@.bea.com>...[vbcol=seagreen]
> grantmitchell7@.yahoo.com wrote:
>
> Not to mention if you plan to do anything transactionally, or use temp tables,
> which would be limited to one real connection, and not involve all the
> under-the-covers connections involved in one logical connection.
> I am confident that an upcoming version of the free MS driver will
> address this. In the mean time you have the option of using commercial
> drivers, or ensuring you run with selectMethod=cursor. As I recall, the
> original poster actually already showed he was running with selectMethod=cursor...
> Joe Weinstein at BEA
Yes the transactional problem is alarming.. Does the driver transact
all the cloned connections for statement when the original connection
is transacted? Who knows but I suppose a test would be relativly
quick.
In regards to selectMethod=cursor - our tests show that result sets
generated with server side cursors can be up to 8 times more expensive
on the database (and slower) than forward only, 'client side' result
sets (depending on the characteristics of the cursor). So instead of
having N*M connections we might end up with N*M server side cursors.
I'm not sure which is worse..
Therefore I would argue that server cursor based result sets are a
major obstacle to scalability and should be avoided at all costs
(except possibly for singleton processes that need a table snapshot
like a report for example).
I hope you are right that an upcoming release resolves this although I
remain skeptical since my guesss is that changing this behavior would
mean a major structural change in the driver's architecture.
On this newsgroup there has been recent reference by Microsoft to a
"new" JDBC driver for SQL 2005. However when I tried to get more
details on this driver there was no response. Perhaps someone from
Microsoft could comment on the "new" driver, and specifically comment
on whether it resolve this serious issue..
Grant

Monday, March 19, 2012

Connection is busy with results for another hstmt & Win2003 SP1

I wrote a web app using an ASP front end (not .NET) connecting to a SQL
Server 2000 (no SP) back end. Both the web server and the database
server are Windows 2003 boxes. The app was running fine two weeks ago
before I went on vacation. While I was gone my net admin applied
Windows 2003 SP1 to the web server. Upon my return I was informed that
the app is no longer working, getting the following error:

[Microsoft][ODBC SQL Server Driver]Connection is busy with results for
another hstmt

Since that is presumably the only thing that changed in my absence I
believe the SP somehow messed up the way the ODBC was working. I tried
moving the SQL Server database to a different Windows 2003 box which
also received the SP1 update and also includes SP3 for SQL Server, but
get the same error.

I am hitting the database like so:

set GetData = CreateObject("ADODB.Command")
GetData.ActiveConnection = SQLConn
GetData.CommandText = "<stored procedure call>"
Set DataRS= GetData.Execute (,,adCmdText)

I appear to get the error when I execute the second call. I am
learning ASP as I go, so maybe this is a trivial problem.Jegg (jsauri@.gmail.com) writes:
> I wrote a web app using an ASP front end (not .NET) connecting to a SQL
> Server 2000 (no SP) back end. Both the web server and the database
> server are Windows 2003 boxes. The app was running fine two weeks ago
> before I went on vacation. While I was gone my net admin applied
> Windows 2003 SP1 to the web server. Upon my return I was informed that
> the app is no longer working, getting the following error:
> [Microsoft][ODBC SQL Server Driver]Connection is busy with results for
> another hstmt
> Since that is presumably the only thing that changed in my absence I
> believe the SP somehow messed up the way the ODBC was working. I tried
> moving the SQL Server database to a different Windows 2003 box which
> also received the SP1 update and also includes SP3 for SQL Server, but
> get the same error.
> I am hitting the database like so:
> set GetData = CreateObject("ADODB.Command")
> GetData.ActiveConnection = SQLConn
> GetData.CommandText = "<stored procedure call>"
> Set DataRS= GetData.Execute (,,adCmdText)
> I appear to get the error when I execute the second call. I am
> learning ASP as I go, so maybe this is a trivial problem.

The gist of the error message is that you have a command that generated
one or more results, that you have not picked up, and you cannot submit
the next stored procedure for execution.

If that procedure generates result sets, you probably want that data.
Then again, it could be a stray debug result set that should not be
there.

Here are some general rules:
o Unless you want explicit row counts back from INSERT/UPDAET/DELETE
operations, submit a SET NOCOUNT ON when you connect. These rowcounts
are actually kind of result sets, and these need to be consumed.
SET NOCOUNT ON eliminates those.
o If you call a stored procedure that is not supposed to return data,
specify the option adExecuteNoRecords.
o When you run a procedure that can return data, be sure to get all
record sets, by looping over .NextRecordset.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Thanks for the info. I did have nocount set to on. However, I did not
know about the adExecuteNoRecords option. That actually will come in
very handy.

On a whim I did manage to elimate the error by adding "DataRS = empty"
after the first stored procedure call. I did not have to do this with
any of the others presumably because I loop through the result set
until EOF (there was known to be only one possible record in the first
result set so I did not do this).

Thanks for your speedy reply!

Sunday, March 11, 2012

Connection in vb 6.0 app

Ok first time poster here. I am very inexperienced with SQL and most all programs I am trying to use, lol. Taking on too much too soon I guess. Ok, I am having a problem in VB but I think it has to do something with a setting I have in SQL server. here it is. I am trying to make a connection to a databasae using this code in VB

ConnectString = "Provider=MSDASQL.1;Password=password;Persist Security Info=True;User ID=sa;Data Source=mas500_app;Initial Catalog="

It is giving me a data source not found and no default driver specified. I know for a fact that this is the correct name for the database. Another mock database i created works fine. So what could be the problem. Is there something in SQL Server that i need to tweak in order for VB to open this connection? Any help would be greatly appreciated and a round of beers would seem to be in order as well. thanks alot.ConnectString = "Provider=MSDASQL.1;Password=password;Persist Security Info=True;User ID=sa;Data Source=mas500_app;Initial Catalog="

You haven't mentioned the Initial Catalog.OK first of all check these things.
1.Make sure that User and password are correct.
2.Check the server name.
Try this one ...
Provider=SQLOLEDB.1;Persist Security Info=true;User ID=sa;Password=password;Initial Catalog=Test
I hope this will solve your problem.
Joydeep|||Hi

I am not 100% on this however I believe that MSDASQL.1 is now considered obsolete. I have certainly never used it. I have certainly seen things on the web re bugs and slow running using this provider. Have a look at http://www.connectionstrings.com/ and see if you can improve things.

HTH|||Hmm - not sure if this is the very same thing but:
http://www.carlprothman.net/Default.aspx?tabid=87#OLEDBProviderForODBCDatabase s|||From Bill himself:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/mdacsdk/htm/mdac_deprecated_components.asp

Also - you would be strongly advised not to use the SA account for connecting to your server. Use either windows authentification (MS recommeded) or create a new SQL Server Login with only the permissions required of the user.

HTH|||Thanks alot for the help. Sad thing was, I had visited connectionstrings.com and even saved it to my favorites last night but failed to even give it a shot. It got me one stone closer to where I need to go. Now it's off to some VB forums to solve other issues. I am sure I will return for more simple stuff in the near future. Again, thanks.

TIbor

Thursday, March 8, 2012

Connection fails in linking SQL Server 2005 tables into Access using DAO 3.51

Hi,

I have an app that creates and attaches tables from SQL Server into an Access mdb using an ODBC link from VB6 using DAO 3.51 on Windows 2000. Recently I upgraded to SQL Server Express edition and tested it. It worked fine against the Express Edition. So, I installed SQL Server 2005 Standard Edition on our Server hoping that they operate identically. How wrong one can be! the same code that worked against Express Edition does not work on Standard Edition.

It is strange that the App works for about 5 seconds which attaches about 38 tables and after that the connection drops and I have a hell of a time to get the rest of the tables linked. The error that comes up is:

Connection failed:
SQLState: '01000'
SQL Server Error: 10060
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]ConnectionOpen (connect()).
Connection failed:
SQLState: '08001'
SQL Server Error: 11
[Microsoft][ODBC SQL Server Driver][TCP/IP Sockets]General network error. Check your network documentation.

The PC that I am using to connect is in a different domain to the Server where the SQL Server database resides. I thought that domains might be the reason. But even joining the PC to the same domain as the server still does not work and behaves the same. So I do not think it is a domain related issue.

I have also looked at the SQL Server and database configurtaions. I cannot see anywhere any specific time out of around 5 seconds. Even the time out through the SQL Server ODBC driver is set to 30 seconds by default as far as I know. So, it looks like there is a time out somewhere but I am absolutely confused as to where this 5 second time out is comming from.

I also thought permissions on the database or tables might be the issue but after looking at the database and table permissions, they all look OK. The user has prettymuch the same access as the SA on the database.

Has anybody came across this problem? If so, I appreciate if someboday can give me a hint as to where I can start.

Thanks,Hi

welcome to the forum :D

Using VB6 to programmatically create linked tables between Access and SQL Server 2005 using DAO 3.51 seems a slightly odd way to go. I presume there is good reason?

Anyway - can you manually link the tables?|||Hi

welcome to the forum :D

Using VB6 to programmatically create linked tables between Access and SQL Server 2005 using DAO 3.51 seems a slightly odd way to go. I presume there is good reason?

Anyway - can you manually link the tables?

Hi,

Thank you for your reply.

Our application is a reasonably complex one. So I will not bore you with the details but if you want I can fill you in outside of this forum. Rest assured that there is a good reason for doing this.

Anyway, The tables link properly if I just open an Access MDB, use the same DSN and select all the tables. However, when they are linked from within our App, they fail. Any ideas?|||Hi,

Finally worked out what was causing this problem.

After looking around the application event logs on the server, I noticed that ISA server was not letting the application to connect. It was saying that the connections for my PC have exceeded the maximum allowed.

I looked at the ISA server and as I expected, there was a maximum of 40 for TCP connections. That is why the application was managing to connect 38 tables (we had two other connections within the app to the SQL Server Database). Once I increased the limit for my PC's IP address, everything went back to normal. So it was not a timeout issue.

They have set this limit to prevents attacks and I can see it working if people use fixed IP addresses. But if DHCP is used, the only other option is to increase the limit globally which goes against the initial gaol of having the limit in the first place.

Thanks

Friday, February 24, 2012

connection err

hi

i use sql 2005 and i create view from linked server

when i select from the view it's o.k

but in the app. i get thes messge :

42000 [Microsoft][SQL Native Client][SQL Server]Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the connection. This ensures consistent query semantics. Enable these options and then reissue your query.

how can i resolve this problam

thenk's

You could try doing:

set ANSI_NULLS on

go

set ANSI_WARNINGS on

go

<select from your view>

instead of just:

<select from your view>

hope that helps,

John

|||

hi

i do this

but no

when i run the proc. or select on the view it is o.k

i get the err when i use the app. (uniface)

it is look like the odbc

thenks

|||

When you execute the QUERY from the application, SET the ANSI settings appropriately, something like this:

SET ANSI_NULLS ON; SET ANSI_WARNINGS ON; SELECT Col1, Col2, etc FROM MyTable WHERE {criteria}

Try the entire line above as the command string. (Or put it into a stored procedure and just call the stored procedure.)

|||


This is sometimes based on the problem that the views are not created with the right ANSI settings, so use

SET ANSI_NULLS ON
GO
SET ANSI_WARNINGS ON
GO

CREATE VIEW SOMEVIEW....

Jens K. Suessmeyer.

http://www.sqlserver2005.de
--

Friday, February 17, 2012

connection

Please help me resolve I'm stuck and a novice
I have a connection string in a VB app that I am working
on but when i execute app I get
Run time Error -2147467259 (80004005) Login failed for
user *** reseaon not a trusted SQL Server connection.
I am set up on SQL server I can run enterprise manage from
my PC and run queries against server but I can not through
my application, I am set up using my windows user info..Hi, Chuck.
Refer to the following site:
http://www.able-consulting.com/ado_conn.htm
You can see many connection examples. This may help you.
"Chuck" <anonymous@.discussions.microsoft.com> wrote in message
news:051d01c3bbd7$20610da0$a501280a@.phx.gbl...
> Please help me resolve I'm stuck and a novice
> I have a connection string in a VB app that I am working
> on but when i execute app I get
> Run time Error -2147467259 (80004005) Login failed for
> user *** reseaon not a trusted SQL Server connection.
> I am set up on SQL server I can run enterprise manage from
> my PC and run queries against server but I can not through
> my application, I am set up using my windows user info..

connecting with database

Using web dev and sql 2005 express

I have published web app and database to my server but can,t get connection string to connect with the database.

---------------------

Login failed for user ''. The user is not associated with a trusted SQL Server connection.

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: Login failed for user ''. The user is not associated with a trusted SQL Server connection.

---------------------

I have created a user in the logins in the sql server security node and give him every permission

going.

I have also created a login in the security node for the database.... and given him all permissions

But I still can,t get the connection string from the web app to connect to the database?

Where am I going wrong

Can you show us your connection string?

|||Try to provide the user name and password in your connection string instead of using Integrated Security=True

|||

I have one database on the server with both the asp.net and my own database within it.

<addname="*******************"connectionString="Data Source=*********.*******.com;Initial Catalog=mydatabasename;Integrated Security=True;User Id=nameofpersonindatabaseschema;Password=hispassword;Connection Timeout=40;User Instance=True"providerName="System.Data.SqlClient" />

<removename="LocalSqlServer"/>

<addname="LocalSqlServer"connectionString="Data Source=*******.*********.com;Initial Catalog=mydatabasename;Integrated Security=True;User Id=nameofpersonindatabaseschema;Password=hispassword;Connection Timeout=40;User Instance=True"providerName="System.Data.SqlClient" />

Now I diid change a few minutes ago .........integrated security =false and got this

---------------

Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance. The connection will be closed.

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: Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance. The connection will be closed.
--------------

Never seen that error before.....

|||

Remove "User Instance=True" and "Integrated Security=True" and set the server to accept SQL Authentication.

|||

OOh sweet...all working...web app loading to server.

now to down grade permissions

well done fatman

Connecting WinCE app directly to SQL Server

We are developing a portable gaming device for use in casinos and bingo
halls. We use SQL Server (2000K) as the backend. The gaming device
software is a Windows CE application written in C/C++. We do not use any
framework as we needed maximum graphics speed to spin reels and do other
animations so that rules out the usual way to connect CE to SQL Server. We
currently use a product called CEFusion that provides us with an ADO
interface to SQL server but it is overkill for what we need and has a high
per client cost.
We are thinking about writing our own SQL client software, and have
sufficient programming skills to do it, but we don't know if that is
something Microsoft allows or if they would release the information needed
to do it. Is this possible? Are there any other solutions?
Hi
ADOCE is you option. No matter what, you need to use some form of OLE
DB/ODBC layer, as MS does not publish the wire protocol spec for TDS.
Look at:
http://msdn.microsoft.com/library/de.../ppc_eplus.asp
http://search.microsoft.com/search/r...=4&s=1&swc= 4
Regards
Mike
"Harold Rappold" wrote:

> We are developing a portable gaming device for use in casinos and bingo
> halls. We use SQL Server (2000K) as the backend. The gaming device
> software is a Windows CE application written in C/C++. We do not use any
> framework as we needed maximum graphics speed to spin reels and do other
> animations so that rules out the usual way to connect CE to SQL Server. We
> currently use a product called CEFusion that provides us with an ADO
> interface to SQL server but it is overkill for what we need and has a high
> per client cost.
> We are thinking about writing our own SQL client software, and have
> sufficient programming skills to do it, but we don't know if that is
> something Microsoft allows or if they would release the information needed
> to do it. Is this possible? Are there any other solutions?
>
>

Sunday, February 12, 2012

connecting to sql server from mobile device

How can I connect to sql server from a mobile device?
the server is on pc and my app is on the device.
I want to perform commands and stored procedures which will be performed online on the pc and get immediate results.
is there any way of achiving that?

You will need to add a reference to SQLClient in your project.
Once this is done its the same as if you were connecting to sqlserver on the full framework with ASP.net or VB.net
here is some sample code



Imports System.Data.Common
Imports System.Data.SqlClient
Private m_connString As String = "user id=sa;password=;initial catalog=Northwind;Server=xxx.xxx.xxx.xxx;"
Private m_ds As New DataSet
Dim l_sqlConn As SqlConnection
Dim l_da As DataAdapter
Dim l_ds As DataSet
Dim l_sqlStmt As String
Try
l_sqlConn = New SqlConnection(m_connString)
l_sqlConn.Open()
l_sqlStmt = "SELECT * FROM tbl_Users ORDER BY FullName"
l_da = New SqlDataAdapter(l_sqlStmt, l_sqlConn)
m_ds = New DataSet
l_da.Fill(m_ds)

Catch ex As SqlException
Dim l_sqlerr As SqlError
For Each l_sqlerr In ex.Errors
MsgBox(l_sqlerr.Message)
Next
Finally
If l_sqlConn.State = ConnectionState.Open Then
l_sqlConn.Close()
l_sqlConn = Nothing
End If
End Try
Dim l_cmd As SqlCommand = l_sqlConn.CreateCommand()
l_cmd.CommandType = CommandType.StoredProcedure
l_cmd.CommandText = "<Stored Procedure Name>"
l_cmd.Parameters.Add(New SqlParameter("UnitOutDate", SqlDbType.DateTime))
l_cmd.Parameters("UnitOutDate").Value = Date.Now
l_cmd.executeNonQuery()

|||It's all good and pretty except for one little thing:
when i try to open the connection i get a "PlatformNotSupportedException"
is there any reason that exception could appears?|||on the emulator or on the device|||

let me specify a little:
I have a device which has a microsoft windows ce .net version 4.2 system.
i try to connect it to sqlserver 2000 that is on a pc server(win 2000 for servers). I create SqlConnect object on the device with the connection string
"Persist Security Info=False;Integrated Security=false; database=northwind; server=xxx.xxx.xxx.xxx; Connect Timeout=30; User ID=testing; Password=test;"
so far so good, but when i perform the function Open(on the device itself), I get the "PlatformNotSupportedException".
and i just cannot figure out why.

|||hmmm it sounds as if something is missing on the device like a library.
Try testing it on the emulator and see if you get the same error|||

That usually means DB collation you're using is not supported on particular device. You can change collation of this DB or get localized device which supports locale you’re using.

|||You hit the correct spot, it really is DB collation.
I created another database on the same server and gave it's collation Latin1_General_CI_AS and tried again and it worked :-)

which brings me to this question:
is there any way to tell the connection object what the database collation is? because I dont think i'm allowed to convert the database to Latin1_General_CI_AS collation.
or any other way to solve this mess...|||you can specify the locale identifier in the connection string.
see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlservercesqlceconnectionclassconnectionstringtopic.asp

-Darren Shaffer
.NET Compact Framework MVP|||

Darren Shaffer wrote:

you can specify the locale identifier in the connection string.
see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlservercesqlceconnectionclassconnectionstringtopic.asp

-Darren Shaffer
.NET Compact Framework MVP

I have this same problem (platformnotsupported) and I don't understand your answer. Problem is with SqlConnection and you say that we must add locale identifier in connection string to SqlCeConnection?
|||

As you correctly noted this is not going to work with SQL Client as it’s about SQL CE. So you have two choices:

1. Change database collation to something which is supported on device.

2. Get device which supports your database collation.

|||

Ilya Tumanov wrote:

As you correctly noted this is not going to work with SQL Client as it’s about SQL CE. So you have two choices:

1. Change database collation to something which is supported on device.

2. Get device which supports your database collation.

I know Smile
Ad 1. No, i can't change collation of my database.
Ad.2. I can't get device which support my database collation (it is Symbol MC9090 with Win CE 5.0 and my database have Polish_CI_AS collation). Works great when I change colllation to Latin1_general but i can't do this with my main database.

Is there an other option? I try RDA but problem with charsets exists, Polish chars ? ? ? ń etc. changes to strange symbols, its useless.

connecting to sql server from mobile device

How can I connect to sql server from a mobile device?
the server is on pc and my app is on the device.
I want to perform commands and stored procedures which will be performed online on the pc and get immediate results.
is there any way of achiving that?

You will need to add a reference to SQLClient in your project.
Once this is done its the same as if you were connecting to sqlserver on the full framework with ASP.net or VB.net
here is some sample code



Imports System.Data.Common
Imports System.Data.SqlClient
Private m_connString As String = "user id=sa;password=;initial catalog=Northwind;Server=xxx.xxx.xxx.xxx;"
Private m_ds As New DataSet
Dim l_sqlConn As SqlConnection
Dim l_da As DataAdapter
Dim l_ds As DataSet
Dim l_sqlStmt As String
Try
l_sqlConn = New SqlConnection(m_connString)
l_sqlConn.Open()
l_sqlStmt = "SELECT * FROM tbl_Users ORDER BY FullName"
l_da = New SqlDataAdapter(l_sqlStmt, l_sqlConn)
m_ds = New DataSet
l_da.Fill(m_ds)

Catch ex As SqlException
Dim l_sqlerr As SqlError
For Each l_sqlerr In ex.Errors
MsgBox(l_sqlerr.Message)
Next
Finally
If l_sqlConn.State = ConnectionState.Open Then
l_sqlConn.Close()
l_sqlConn = Nothing
End If
End Try
Dim l_cmd As SqlCommand = l_sqlConn.CreateCommand()
l_cmd.CommandType = CommandType.StoredProcedure
l_cmd.CommandText = "<Stored Procedure Name>"
l_cmd.Parameters.Add(New SqlParameter("UnitOutDate", SqlDbType.DateTime))
l_cmd.Parameters("UnitOutDate").Value = Date.Now
l_cmd.executeNonQuery()

|||It's all good and pretty except for one little thing:
when i try to open the connection i get a "PlatformNotSupportedException"
is there any reason that exception could appears?|||on the emulator or on the device|||

let me specify a little:
I have a device which has a microsoft windows ce .net version 4.2 system.
i try to connect it to sqlserver 2000 that is on a pc server(win 2000 for servers). I create SqlConnect object on the device with the connection string
"Persist Security Info=False;Integrated Security=false; database=northwind; server=xxx.xxx.xxx.xxx; Connect Timeout=30; User ID=testing; Password=test;"
so far so good, but when i perform the function Open(on the device itself), I get the "PlatformNotSupportedException".
and i just cannot figure out why.

|||hmmm it sounds as if something is missing on the device like a library.
Try testing it on the emulator and see if you get the same error

|||

That usually means DB collation you're using is not supported on particular device. You can change collation of this DB or get localized device which supports locale you’re using.

|||You hit the correct spot, it really is DB collation.
I created another database on the same server and gave it's collation Latin1_General_CI_AS and tried again and it worked :-)

which brings me to this question:
is there any way to tell the connection object what the database collation is? because I dont think i'm allowed to convert the database to Latin1_General_CI_AS collation.
or any other way to solve this mess...|||you can specify the locale identifier in the connection string.
see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlservercesqlceconnectionclassconnectionstringtopic.asp

-Darren Shaffer
.NET Compact Framework MVP|||

Darren Shaffer wrote:

you can specify the locale identifier in the connection string.
see:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqlservercesqlceconnectionclassconnectionstringtopic.asp

-Darren Shaffer
.NET Compact Framework MVP

I have this same problem (platformnotsupported) and I don't understand your answer. Problem is with SqlConnection and you say that we must add locale identifier in connection string to SqlCeConnection?|||

As you correctly noted this is not going to work with SQL Client as it’s about SQL CE. So you have two choices:

1. Change database collation to something which is supported on device.

2. Get device which supports your database collation.

|||

Ilya Tumanov wrote:

As you correctly noted this is not going to work with SQL Client as it’s about SQL CE. So you have two choices:

1. Change database collation to something which is supported on device.

2. Get device which supports your database collation.

I know Smile
Ad 1. No, i can't change collation of my database.
Ad.2. I can't get device which support my database collation (it is Symbol MC9090 with Win CE 5.0 and my database have Polish_CI_AS collation). Works great when I change colllation to Latin1_general but i can't do this with my main database.

Is there an other option? I try RDA but problem with charsets exists, Polish chars ? ? ? ń etc. changes to strange symbols, its useless.

Friday, February 10, 2012

Connecting to SQL Server database via windows form app

Hi, I have developed a windows form application which connects to a sql server 2k database via the following conneciton string:

Private con As New SqlConnection("Data Source=(local);trusted_connection=true;Initial Catalog=Database1")

This works fine for running locally but I need to give my Windows form application to other users on the lan and have them reach my database server. So next I tried:

Private con As New SqlConnection("WorkStation ID= E134017.nw.nos.Boeing.com;Data Source=(local);trusted_connection=true;Initial Catalog=Database1")

where E134017.nw.nos.boeing.com is the full network path to my computer

It does not work and results in "Server does not exist or access is denied"

I next went in SQL and turned on tcp/ip and still no luck.

Any ideas,

Fred

The good way of doing this, at least in my opinion is to kepp the connectin string in App.Config file, thus you can chage it without bother to compile again.
so you'll have something like

<configuration>
<add key="ConnectionString" value="server=(local);trusted_connection=yes;database=b1;"/>
</configuration>

when you copy the application to another workstation, you can change the connection string to server=DB_SERVER_NAME;trusted_connection=yes;database=b1;", where DB_SERVER_NAME is the name of the cmputer where the SQL Server is or the one that you refer to local. Then you have to add the remote users into your database server and grant access to db1.|||Your connection string is looking for a SQL Server on the user's workstation. Don't you want to change your Data Source property to point to the name of your database server?

Darrel|||that's the reason i explain in the 2nd paragraph to replace the DB_SERVER_NAME appropriately.|||Ok, this is the connection string I am using

Data Source = \\E134017.nw.nos.boeing.com;Trusted_Connection=True;Initial Catalog=Database1

\\E134017.nw.nos.boeing.com is the full path to the server computer. E134017 is the computer name.

Using this connection string, I go to another computer on the network and login and try to reach my server thru my connection string.

I get"Server does not exist or access is denied"

That same connection string works fine as a login on the server itself.

I am lost.

Fred|||

The SQL forum is a better venue for your question.

|||This is the connection string we use in our Winapps:
Data Source=<Your server name here>;user id=<your user ID here>;password=<users Password here>;initial catalog=<Database name here>
Hope this helps
Deasun|||then use this

server=E134017;trusted_connection=yes;database=Database1;