473,406 Members | 2,705 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,406 software developers and data experts.

OleDB connection.Open() fails in WebService only

1
I have a simple webservice that performs a SELECT query against a database, and then an INSERT statement on the same database/table. The problem arises at the time when we create the second OleDB connection object and attempt to Open() it. The connection string is exactly the same for both connection objects. Another intersting thing is that this code works fine when it is used in a Windows Form project.

The code snippet:
Expand|Select|Wrap|Line Numbers
  1.  
  2. try
  3. {
  4. // Connect to database
  5. // Initialize a new OleDbConnection
  6. cnOleDBSDE = new OleDbConnection();
  7.  
  8. // Setup the connection string 
  9. cnOleDBSDE.ConnectionString = "Data Provider=" +DBProvider+ ";"+
  10. "Provider=" + DBShapeProvider + ";" +
  11. "Data Source=" + DBName + ";" +
  12. "Pooling=" + Pooling.ToString() + ";" +
  13. "User Id=" + UserId + ";" +
  14. "Password=" + Password;
  15. // Open the connection
  16. cnOleDBSDE.Open();
  17. }
  18.  
Here is 'cnOleDBSDE' the first time around just before .Open() is called:
Expand|Select|Wrap|Line Numbers
  1.  
  2. cnOleDBSDE
  3. {System.Data.OleDb.OleDbConnection}
  4. base {System.Data.Common.DbConnection}: {System.Data.OleDb.OleDbConnection}
  5. ConnectionString: "Data Provider=MSDAORA.1;Provider=MSDataShape;Data Source=sdeprod;Pooling=False;User Id=UID;Password=PASSWORD"
  6. ConnectionTimeout: 15
  7. Database: ""
  8. DataSource: "sdeprod"
  9. Provider: "MSDataShape"
  10. ServerVersion: 'cnOleDBSDE.ServerVersion' threw an exception of type 'System.InvalidOperationException'
  11. State: Closed
  12.  
  13.  
And here is cnOleDBSDE the second time around (when it fails), just before .Open() is called:

Expand|Select|Wrap|Line Numbers
  1.  cnOleDBSDE 
  2. {System.Data.OleDb.OleDbConnection}
  3. base {System.Data.Common.DbConnection}: {System.Data.OleDb.OleDbConnection}
  4. ConnectionString: "Data Provider=MSDAORA.1;Provider=MSDataShape;Data Source=sdeprod;Pooling=False;User Id=UID;Password=PASSWORD"
  5. ConnectionTimeout: 15
  6. Database: ""
  7. DataSource: "sdeprod"
  8. Provider: "MSDataShape"
  9. ServerVersion: 'cnOleDBSDE.ServerVersion' threw an exception of type 'System.InvalidOperationException'
  10. State: Closed
  11.  
I don't see any differences. Here is the exception that is thrown:

ex
{"Data provider could not be initialized."}
[System.Data.OleDb.OleDbException]: {"Data provider could not be initialized."}
Data: {System.Collections.ListDictionaryInternal}
HelpLink: null
InnerException: null
Message: "Data provider could not be initialized."
Source: "MSDataShape"
StackTrace: " at System.Data.OleDb.OleDbConnectionInternal..ctor(Ol eDbConnectionString constr, OleDbConnection connection)\r\n at System.Data.OleDb.OleDbConnectionFactory.CreateCon nection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)\r\n at System.Data.ProviderBase.DbConnectionFactory.Creat eNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)\r\n at System.Data.ProviderBase.DbConnectionFactory.GetCo nnection(DbConnection owningConnection)\r\n at System.Data.ProviderBase.DbConnectionClosed.OpenCo nnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)\r\n at System.Data.OleDb.OleDbConnection.Open()\r\n at GDAC.GDAC.OpenOleDbConnection(String DBName, String DBProvider, String DBShapeProvider, Boolean Pooling, String UserId, String Password) in D:\\ETS\\GDAC\\GDAC.cs:line 471"
TargetSite: {Void .ctor(System.Data.OleDb.OleDbConnectionString, System.Data.OleDb.OleDbConnection)}

Any ideas?
Jul 24 '08 #1
1 4542
jhardman
3,406 Expert 2GB
hmm. I don't think you can make a web service in ASP, and this doesn't look like VBScript. Perhaps you meant to post in the .NET forum? I'll move it over for you.

Jared
Jul 25 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: TF | last post by:
Hi, I have to access data from a comma delimited file in .net windows application (VB.net or C#). I am using Microsoft.Jet.OLEDB.4.0 provider for this purpose. Now the problem is when i extract...
3
by: Chris Thunell | last post by:
I have a program where i connect to an access database and get some information out of it. I'm using the oledb.3.51 version, my computer doesn't seem to have the 4.0 version, but the computer that...
7
by: aacool | last post by:
Hi, I've been trying to open an Excel connection through OLEDB with the code below: string ConnectString =@"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + fileName.Text +...
2
by: Martin | last post by:
Hi, I currently have an application that connects to an MS ACCESS database. This application uses an OLEDB connection string for MS ACCESS. Now, I'd like to upsize the application so I converted...
5
by: petro | last post by:
Hello all, My asp.net web application works on my machine but I get the following error on our test web server, There is only one oracle home on the test server. Does anyone know how to resolve...
3
by: blue875 | last post by:
When I run this connection, I get a security error. String connectStr = @"Provider=Microsoft.Jet.OLEDB.4.0;" + @"User Id=USER; Password=PASS;" + @"Data Source=\\SERVER\DIRECTORY\Data.mdb;" +...
1
by: Flupke | last post by:
Hello everyone, I'm trying to make a OLEDB-connection between VB.Net (Visuel Studio 2005) and an Access-2003 database. This works smoothly and without a single problem on a Windows XP desktop...
1
by: Flupke | last post by:
I'm trying to set up an oledb connection between vb.net in visual studio 2005 and an access 2003 database. This works without a single problem under windows XP but not on a laptop configured with...
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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.