I support a LOB application written in MS Access VBA with a SQL Server back end. One feature of the application is the ability to open a second instance of the application, allowing the users to view/modify two records at the same time.
The first time I open the application it connects and everything works fine. However when I attempt to open the second instance I get the following error message:
-2147467259 - Method "OpenConnection" of object _CurrentProject failed.
This is the line of code executing when the error occurs:
CurrentProject.OpenConnection strConnection
I have stepped through the code and verified that strConnection is the same connection string in both the first and second instances of the application
I'm running out of things to look for. Any ideas are greatly appreciated!
UPDATE: It appears that something is not allowing the second MSACCESS.EXE instance to use the same connection string. My connection string is below, with database and server substituted for the actual database and server.
PROVIDER=SQLOLEDB.1;INTEGRATED SECURITY=SSPI;PERSIST SECURITY INFO=FALSE;INITIAL CATALOG=database;DATA SOURCE=server
Try
MultipleActiveResultSets=True
(http://msdn.microsoft.com/en-us/library/h32h3abf(v=vs.110).aspx)
Would it be better to open a new form from the same application?
dim frm as ShowCar_Form
frm.Show
Related
My company is switching from an Oracle 'on-prem' data warehouse to Snowflake cloud storage.
I support MANY Microsoft Access apps that use pass-through queries which use a simple string in the connection string property. Once a user had downloaded the appropriate Oracle Admin (X64) client, they are in business.
With snowflake, the client software is also a simple download. I am stuck, however, getting the connection string to work. Here is where I'm currently at:
ODBC;DRIVER={SnowflakeDSIIDriver};SERVER=xxxx.us-east-1.privatelink.snowflakecomputing.com;UID=xxx#xxx.com;PWD=xxx;WH=XYZ;DATABASE=XYZ;ROLE=XYZ
(This string returns error: ODBC--call failed. No active warehouse selected in the current session. Select an active warehouse with the 'use warehouse' command. (#606))
Has anyone successfully managed to connect a Microsoft Access Pass-through query to Snowflake and retrieve results?
(Please note, the authenticator is not externalbrowser)
(MS Access 365 for Enterprise, 64-bit)
Optional Connection Parameters
warehouse (Warehouse)
Specifies the default warehouse to use for sessions initiated by the driver.
WH=XYZ; should rather be WAREHOUSE=XYZ;
Ok, to those who may be interested, the below works for the pass through query connection string property:
ODBC;
driver={SnowflakeDSIIDriver};
server=xxxxxxxxx.xx-xxxx-x.xxxxxxxxxx.snowflakecomputing.com;
database=xxxxxxxxxx;
warehouse=xxxxxxxxxxxxxxxx;
role=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
Uid=xxxxxxxxxxx#xxxxxxx.com;
Pwd=xxxxxxxxx;
In the init phase of my ms access app, I set some links to ODBC tables in a postgresql db. I also set the application name with a statement "set application_name = ... ;".
So far it works well, but ...
After a phase of inactivity (or some other reason) the connection is closed. After accessing a linked table, the connection is reopen automatically. That is pretty cool, but ...
=> the application_name is lost.
Question: Can I use a trigger function, when ms access is opening a new connection or is there any other solution?
If you're just using linked tables, then no, unfortunately, this is not possible.
Access manages the connection internally for tables, and doesn't fire any events when reconnecting.
If you're only using forms, you can manage the connection yourself using a predeclared self-healing object. In that case you can raise events when reconnecting, and let the object set the application name.
Another half-solution is to use passthrough queries instead of tables, and start them all off with set application_name
I am trying to create a dynamic data source in SSRS. I have a generic report that needs to be run across multiple database servers, requiring a way to connect to each based on a parameter.
I have setup my parameters in a way where I can generate the following connection string:
Data Source=172.16.1.111;Initial Catalog=TESTDB
If I plug that connection string into the "Connection String" text area field in the Data Source Properties window and click "Test Connection," I get the "Connection created successfully" message.
However, if I attempt to create an expression with the same data source (forget about the dynamic data source for a minute), like as shown below, I get a "The ConnectionString property has not been initialized" error message when trying to test the connection.
="Data Source=172.16.1.111;Initial Catalog=TESTDB"
Based on other examples I have seen looking this up online, this type of connection string definition is supposed to work.
My end goal is to create something like:
="Data Source=" + Parameter!Server.Value + ";Initial Catalog=" + Parameter!Database.Value
which would allow me to connect to any database based on the user selection.
Does anyone have any suggestions for what I might be doing wrong? I am using SQL Server 2014 Report Builder.
This ended up being an issue with the report builder. Once I deployed the report I was able to get this work. For some reason, even if you hard code the connection string as I mentioned above, expressions will not evaluate at runtime when running from within the report builder.
Hope this helps someone else in the future!
I have a local SQL DB and an Azure SQL DB. In my data flow I am trying to pass data from local (ole db source) to Azure (ole db destination).
I am unable to save the password for the connection string so I have parameterized the connection string of the data flow task but I seem unable to work out how to get the destination to use it?
I know this isn't best practice but I just want to prototype a few things. Is this possible?
Thanks
Double click project params and add your connection string as a parameter. Give it any name you want, select string then paste your Azure connection string that you have copied directly from you Azure portal connection string option.
This creates a project level conn string parameter.
Right click connection managers and create a new ADO.Net connection manager. This should be fairly straightforward.
Once completed, select this connection manager and add an expression to it from the property window:
In the Property Expression Editor: (1) Select a property called ConnectionString. (2) Select the elipsis beside expression. From the pop up open the project parameters in the left hand area and you will see the connection parameter you created earlier. Drag this into the expression text area. Evaluate the expression to check it works.
Click OK
You should now be able to use this as an Azure connection without getting any errors
I have a Web Service Task in a dtsx package developed in Visual Studio. It has an httpconnection with a Timeout setting of 30 seconds. The package is included as a step in a sql server (2008 r2) agent job. When I deployed the package, I set it up to be stored in SQL Server.
I would like to be able to change just the Timeout setting in the sql job step, but I'm not sure how to do this or even if it's possible. At the moment I'm changing the setting within VS then redeploying the package each time.
Can anyone give me any help on how to do this? Which tab of the job step should this be set on?
One thing to be aware of, there is the timeout property on the HTTP Connection Manager but that's for controlling the actual connection to the web service. It does not control the actual time for invoking a particular method, if that makes sense.
I had a 2005 package that consumed a web service for cleaning addresses. The webservice was hosted internally so the HTTP Connection was as LAN speeds, no issue there. The service itself could standardize one address pretty quick. When I need to bulk clean a few hundred thousand, then it takes a not insignificant amount of time. The XML task has a built in, as of 2008 R2, unchangable default timeout of 6 minutes. That's not so handy if you need it to be 3601 seconds or never time out. I'm having trouble finding documentation calling that out but you can verify the behaviour by ginning up a service that sleeps for 6+ minutes.
Our resolution was to use a script task to handle the actual service call so that we could override the Timeout property for the service call.
Public Sub Main()
Dim url As String
Dim inboundFile As String
Dim success As Boolean
Dim timeoutMs As Integer
' 1 hour = 60min * 60 sec * 1000 milliseconds
timeoutMs = 60 * 60 * 1000
inboundFile = CStr(Dts.Variables("NetworkShareInput").Value)
url = CStr(Dts.Variables("WebService").Value)
Try
Dim svc As New AddressCleanerService(url)
' Explicitly provide a timeout for the web service connection
svc.Timeout = timeoutMs
svc.Credentials = System.Net.CredentialCache.DefaultCredentials
success = svc.CleanBulkAddresses(inboundFile)
Catch ex As Exception
Dts.Events.FireError(0, "Address cleaning", "Something failed in the address component stuff", String.Empty, 0)
Dts.Events.FireError(0, "Address cleaning", ex.ToString(), String.Empty, 0)
End Try
If (success) Then
Dts.TaskResult = ScriptResults.Success
Else
Dts.TaskResult = ScriptResults.Failure
End If
End Sub
One way to do it is to use expressions and pass the timeout value from sql agent job. Below are highlevel steps:
Create a variable in your SSIS package to hold the timeout value.
In the properties window of the HTTP connection, click on the expressions eclipse button.
Expand Property dropdown in the property expression editor. Select Timeout.
And use the timeout variable you created earlier. Something like: #[User::Timeout]
In SQL Agent, use command line as job type, and use DTEXEC to execute the SSIS package.
In the DTEXEC command you can pass values to variables. Below is a commad example:
dtexec /f C:\SSIS\Package.dtsx /set \package.variables[Timeout].Value;45
So, when you want to change the timeout value simple change it in the SQL Agent job instead of redeploying the package.
First, if you still have control over the source code, I would point you to package configurations. Then you can edit these settings in an XML file or a data table.
Assuming you don't, you can push some values into the package using the "Set Values" tab of the job step. The hard part is getting the property path correct. Again, using Visual Studio and the package configurations feature, you should be able to find the right name.
Try this for the property path: \Package.Connections[myHttpConnection].Properties[Timeout].Value