ADODB connection to a DBF in Azure WebApp - azure

I'm using an Azure WebApp (Tier: F1)
I hosted these files and directories:
/wwwroot/default.asp
/wwwroot/Data
/wwwroot/Data/customers.dbf
/wwwroot/Data/vessels.dbf
The default.asp file contains the following:
<%
On Error Resume Next
Response.Write("Path: " & Server.MapPath("Data") & "<br>")
DBRoot = "D:\home\site\wwwroot\Data\"
Set conn = Server.CreateObject("ADODB.Connection")
DataBase = "DRIVER={Microsoft Visual FoxPro Driver};SourceType=DBF;sourcedb="& DBRoot
conn.Open DataBase
If Err.Number <> 0 Then
Response.Write (Err.Description)
Response.End
End If
%>
And i'm getting this output:
Path: D:\home\site\wwwroot\Data
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
I'm not sure if the error is because:
The driver (Microsoft Visual FoxPro Driver) is not installed or supported in Azure
The path is incorrect (because web apps in Azure have a shared physical path)
How can I make this connection work?
Note: just as a reference, I intend to use these dbf files with SQL queries such as this:
<%
conn.Execute("SELECT * FROM [customers.dbf] WHERE userId ='"& userId &"'")
%>
All these used to work in an old hosting I had. It doesn't works in Azure.

Related

What is the method for making an ADODB connection from VBA to a (Google) Cloud SQL database?

Connecting to Cloud SQL appears to be different than connecting to normal MySQL databases.
I have added the 'Instance connection name' after the 'Public IP address'.
I am getting an error:
'Unknown MySQL server host'
Dim Cnn As Object
Set Cnn = CreateObject("ADODB.Connection")
Cnn.Open ("DRIVER={MySQL ODBC 5.3 Unicode Driver};SERVER=xxx.xxx.xxx.xxx\instanceConnectionName;DATABASE=databaseName" & ";USER=user;PASSWORD=abcd")
If Cnn.State = adStateOpen Then
Debug.Print "Connection"
Else
Debug.Print "No Connection"
End If
Cnn.Close
I would recommend to use the SQL Proxy and then for the connection would be like if the database was in your localhost.
So the steps would be:
Install Cloud SQL Proxy in your computer
Start the cloud SQL Proxy
Connect as I f you were connecting to a local database
the code would be:
Dim Cnn As Object
Set Cnn = CreateObject("ADODB.Connection")
Cnn.Open ("DRIVER={MySQL ODBC 5.3 Unicode Driver};SERVER=172.0.0.1;DATABASE=<DATABASENAME>;USER=<USERNAME>;PASSWORD=<PASSWORD>)
If Cnn.State = adStateOpen Then
Debug.Print "Connection"
Else
Debug.Print "No Connection"
End If
Cnn.Close
What kind of DB are you connection to? You can find all kinds of connection strings here.
https://www.connectionstrings.com/
Also, go to your ODBC drivers and see what you have installed. Your code has to match what you have installed. Here is an image of what I have on my system.
So, for instance, you have to have 'MySQL ODBC 5.3 Unicode Driver' installed because that's what you are referencing in your code. Try that and feed back with your findings and results.

Data source name not found and no default driver specified". Failed to acquire connection "DestinationConnectionOLEDB"

I have created a SSIS package to import the excel to sql. I have set the connection string and excel file path by expression.
After that I'm trying to invoke package by c# WPF application by
Microsoft.SqlServer.Dts.Runtime.DTSExecResult and passing value of connection string and excel path. My code is as shown below
Application app = new Application();
Package package = null;
//Load the SSIS Package which will be executed
package = app.LoadPackage("D:\\EMS-Docs\\new\\SSIS\\SSISProject\\obj\\Development\\Package2.dtsx", null);
//Pass the varibles into SSIS Package
//Microsoft.SqlServer.Dts.Runtime.Variables myVars = package.Variables;
package.Variables["User::EXLPath"].Value = "D:\\EMS-Docs\\SSIS\\PRACTICAL_1901_LOT-2.xls";
package.Variables["User::SQLConn"].Value = GlobalClass.TransactionalDBConnectionString;
//Execute the SSIS Package and store the Execution Result
Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute();
The error
SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft OLE DB Provider for ODBC Drivers" Hresult: 0x80004005 Description: "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".
Failed to acquire connection "DestinationConnectionOLEDB". Connection may not be configured correctly or you may not have the right permissions on this connection.
Error cause
The main error is:
"[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
Which means that the main problem is in the connection manager or the connection string.
Possible solutions
Make sure that you have set the connection manager and Data Flow Tasks Delay Validation property to True
Make sure that you are passing a valid connection string value by executing the package from visual studio with the same variable value.
Make sure that the application mode (32bit/64bit) is identical with the ODBC driver version. As example: if you have 32-bit ODBC driver installed, make sure that you are running the application in 32-bit mode
If you are connecting to SQL Server you can use SQL Native Client or Microsoft OLEDB Provider for SQL Server instead of ODBC provider
Additional Information
Also, you can refer to the following knowledge base article for more information about the error possible causes / solutions:
DATADIRECT "DATA SOURCE NAME NOT FOUND AND NO DEFAULT DRIVER SPECIFIED" ERROR

Error while creating Sybase Connection from VB

I am trying to connect to Sybase ASE from VB and getting following error
Function createConnection() As ADODB.Connection
Dim ConnectString As String Dim ConnString As String
Set conn = New ADODB.Connection
.Mode = adModeReadWrite
.ConnectionTimeout = 15
.ConnectionString = "Provider=ASEOLEDB;" & _
"Server Name=" & Range("DBServerName") & _
";Initial Catalog=db;" & _
"User Id=user;" & _
"Password=password"
.Open
End With
Set createConnection = conn
End Function
Any help would be much appreciated.
I would suggest you fist to check odbcad as described here.
If you can find any mention of ASEOLEDB there, then you just have problem either with the app using wrong type of drivers (32-bit vs 64-bit) or with a connection string.
But as the error message suggests, you might be missing just the provider - same problem as here. These libraries are usually part of these installations:
SAP/Sybase ASE
SAP/Sybase ASE PC Client CD
SAP/Sybase ASE SDK
All of these can be acquired on SAP portal, however you need a login to that place as this software is accessible only on purchase. You can find here a link of PC Client CD content (Sybase infocenter website) and a manual on OLEDB here.
Unfortunately only freely downloadable ASE is for Linux, which is useless for you. Maybe you can find on that W7 machine installation media ...
Download & Install Provider
http://devzone.advantagedatabase.com/dz/content.aspx?key=20&Release=19&Product=15
use below commands to register provider
regsvr32 sybdrvodb.dll
regsvr32 sybdrvodb64.dll
Details:
http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc20116.1550/html/aseodbc/aseodbc43.htm

ORA-12560: TNS: protocol adapter error issue: Excel 64-bit/Windows 10 64-bit

I'm running a VBA script I used to use when connecting to Oracle database through Excel 32-bit but now I'm using Excel 64-bit.
VBA code:
Set cn1 = New ADODB.Connection
Set rs1 = New ADODB.Recordset
cn1.ConnectionString = "Driver={Microsoft ODBC for Oracle};Server=BR1P1;Uid=BR1USER;Pwd=myPass"
cn1.Open
rs1.Open Query, cn1
When I execute "cn1.open" I get this error:
"Run-time error'-214746... [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
Then I tried to solve adding a new data source:
ODBC Data Source Administrator (64-bit)> File DSN> click in Add...> from list I select: Oracle em OraClient11g_home1 ("Oracle em" means "Oracle for", my OS in in portuguese)> Next> browse to the file: "C:\Windows\System32\odbcad32.exe"> Next> Finish
Doing so system will give me the driver name: "Oracle em OracleClient11g_home1"
Afterwards it will prompt for Service Name, User Name and Password. I inform server Name according to my TNSNAMES.ORA
Back to VBA I changed the code according to the driver name:
cn1.ConnectionString = "Driver={Oracle em OracleClient11g_home1}"
Now when execute "cn1.Open" in VBA I receive this new error message:
"Run-time error'-214746... [Oracle][ODBC]ORA-12560: TNS:protocol adapter error"
My TNSNAMES.ORA file is like this:
BR1P1 = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = myhost.com)(PORT = 1575))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = BR1P1)))
Well I'm just stucked on this. Please I appreciate any help on this.
It's being a pain after I changed my MS Office to 64-bit version.
The Microsoft ODBC for Oracle exist only for 32-bit thus you cannot use it for 64-bit Excel.
If you like to use the 64-bit ODBC driver from Oracle then you must install it. Download the driver from 64-bit Oracle Data Access Components (ODAC) Downloads
The ConnectionString format of the Oracle ODBC Driver is different to the format of the Microsoft ODBC driver, see
Microsoft ODBC Driver - Connection String Format and Attributes
Oracle ODBC Driver - Format of the Connection String
or https://www.connectionstrings.com/oracle/ -> ODBC drivers
So, for Oracle your ConnectionString
Driver={Microsoft ODBC for Oracle};Server=BR1P1;Uid=BR1USER;Pwd=myPass
will be
Driver={Oracle em OracleClient11g_home1};DBQ=BR1P1;Uid=BR1USER;Pwd=myPass

ASP 80004005 error on IIS 7.5

We are trying to run an ASP application on windows 2008 R2 standard (64 bit processor & iis 7.5). ASP application connects to MS Access database. IIS is running fine and Asp is running fine. But when ASP code tries to connect to MS-Access DB, its giving 500 error.
FilePath C:\INETPUB\WWWROOT\XXXXXX\XXXXX_SECTIONS.ASP
LineNumber 14
CurrentStatement LevelTop.Open()
ErrorCode 80004005
Error is coming exactly while opening connection to MS Access DB.
We checked with Process Monitor utility. I have attached the log file of process monitor. We assumed its a permission issue and granted all permissions, but still we are getting same error.
We even tried giving administration group user as IIS user. But still getting same issue.
[Edit]
Ok thanks joel. I am newbie to this environment.
I checked this link and installed this http://www.microsoft.com/downloads/en/details.aspx?FamilyID=C06B8369-60DD-4B64-A44B-84B371EDE16D.
Now I am getting this error
*ErrorCode: 800a0e7a
Description: Provider cannot be found. It may not be properly installed *
this is my connection string
"Provider=Microsoft.ACE.OLEDB.12.0;DBQ=C:\inetpub\wwwroot\xxxxx\App_Data\xxxxx.mdb;Persist Security Info=False;"
Set ThisSection = Server.CreateObject("ADODB.Recordset")
ThisSection.ActiveConnection = ConnectionString
ThisSection.Source = "SELECT * FROM table WHERE ID = " + Replace(ThisSection__MMColParam, "'", "''") + ""
ThisSection.CursorType = 0
ThisSection.CursorLocation = 2
ThisSection.LockType = 1
ThisSection.Open() ->** getting error exactly at this line**
The error message is that the provider cannot be found.
Two sources of this error could be:
Access is not installed
Access 32bit is installed and IIS is looking for the 64bit version, or the other way around
There should be an error in your eventlog.
Also you could try a restart after the installation of the Access driver.

Resources