473,289 Members | 2,089 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,289 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 4526
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.