Connect to excel 2007 file using ADOConnection in Delphi7 - delphi

I want to connect to an excel 2007 file(.xlsx) using delphi 7, so I used a AdoConnection and set its connectionstring property as:
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test\qm\Results-summary.xlsx;Extended Properties="Excel 12.0;IMEX=1";Persist Security Info=False
But when I active the AdoConnection i get this error:
Could not find installable ISAM.
Where is the problem?

I found the solution. my mistake was using Microsoft.Jet.OLEDB.4.0 driver for excel 2007 file. I changed it to Microsoft.ACE.OLEDB.12.0 driver and set the extended property to Extended Properties="Excel 12.0 Xml;HDR=yes", now my connection string is:
Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source=C:\test\qm\Results-summary.xlsx;Mode=Share Deny None;Extended Properties="Excel 12.0 Xml;HDR=yes";Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Database Password="";Jet OLEDB:Engine Type=37;Jet OLEDB:Database Locking Mode=0;Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Global Bulk Transactions=1;Jet OLEDB:New Database Password="";Jet OLEDB:Create System Database=False;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;Jet OLEDB:SFP=False;Jet OLEDB:Support Complex Data=False
and it works:)

Related

How to download file using TIdHTTP Indy component?

I get this error when I try to download a file using TIdHTTP component:
First chance exception at $76D8AAF2. Exception class EIdOSSLUnderlyingCryptoError with message
'Error connecting with SSL.
error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'.
Process Project1.exe (3684)
I have Indy version 10.6.2.5341 shipped with Embarcadero Rad Studio 10.1 Berlin.
I'm using IdSSLIOHandlerSocketOpenSSL with those options enabled:
[sslvtlsv1, sslvtlsv1_1, sslvtlsv1_2], but still same error, I also have ssl dlls in my application exe directory (libeay32.dll and ssleay32.dll) version 1.0.2u, got it from this post:
How can we connect with a website? Getting SSL error 1409442E
And this code I use to download a file:
const UnicodeString URL = "https://www.rarlab.com/rar/winrar-x64-60b1.exe";
TMemoryStream *ms = new TMemoryStream();
try
{
IdHTTP1->Get(URL, ms);
ms->SaveToFile("E://winrar.exe");
}
__finally
{
delete ms;
}
Update: I upgraded to Indy version 10.6.2.0 and still have the same SSL problem.

Delphi App Upgrade from Delphi 10 Seattle to Delphi 13.3.3 Rio - SQL Server Db Column with Space(s) not working in ClientDataSet and SimpleDataSet

We are upgrading our Working Delphi App from Delphi 10 Seattle to Delphi 13.3.3 Rio - SQL Server Db Column with Space(s)
The code associated with this issue works as intended in Delphi 10 Seattle and SQLServer.
The problem is that the Column "Image Type" has a space in its name.
I am looking to solve the space in column names for ClientDataSet and SimpleDataSet
This applies to other table that we have. I know that a parameterized SQL would work as a workaround.
The following Insert SQL Execute statements work as intended.
INSERT INTO tblImages ("Line","Image Type","Image") VALUES ('1','jpg','imageBlobValue')
or
INSERT INTO tblImages ([Line],[Image Type],[Image]) VALUES ('1','jpg','imageBlobValue')
The following Insert via ClientDataSet Does not
//Query
SQLQueryInsert.Cose;
SQLQueryInsert.SQL:='SELECT "Line","Image Type","Image" FROM tblImages';//Oracle & Other SQLs
SQLQueryInsert.SQL:='SELECT [Line],[Image Type],[Image] from tblImages';//SQLServer
SQLQueryInsert.Open;
//Set Non parameterized values
//DataSet
ClientDataSettblImages.Close;
ClientDataSettblImages.Open;
ClientDataSettblImages.Insert;
ClientDataSettblImages['Line']:='1';
ClientDataSettblImages['Image Type']:='jpg';
ClientDataSettblImages['Image']:='imageBlobValue';
//Apply Updates
ClientDataSettblImages.Post;
If ClientDataSettblImages.ChangeCount > 0 then
Begin
ClientDataSettblImages.ApplyUpdates(-1);
End
If I look at the text output of SQLMonitor I can see the following:
Error: SQL State: 1, SQL Error Code: 156, Level: 15, Procedure: , Line: 2
Incorrect syntax near the keyword 'Type'.
ClientDataSet & SimpleDataSet have the same issue. I can see that the problem is the column with the space called "Image Type". The insert via the ClientDataSet works fine without the column "Image Type".
This either looks like a ClientDataSet bug or I'm missing a simple detail somewhere.
Looks like the answer is to add the following Parameter to SQLConnection: UseQuoteChar=True. The Application is now working as intended.

embedded firebird 2.5 >> DBX Error: Driver could not be properly initialised

i'm try to connect to firebird 2.5 Embedded version(win32) with Delphi XE , I get the error when a click Test Connection
any help?
LibraryName and VendorLib should be in search path
copy LibraryName "i'm using dbx4fb.dll from https://sites.google.com/site/dbxfirebird/home" and
VendorLib "fbclient.dll founded in firebird directory\bin" to the search path "for delphi xe : Program Files\Embarcadero\RAD Studio\8.0\bin"

Exception while calling stored procedure :Bigger type length than Maximum

HI I am getting this exception when I am calling any stored procedure from my J2EE app.
Exception while calling stored procedure :Bigger type length than Maximum
I am having Oracle 9.1.0.7, JDK1.4 and using ojdbc14.jar running on Weblogic 8.1
Please advise what could be the root cause ?
Below is the manifest of my ojdbc14.jar
Manifest-Version: 1.0
Implementation-Version: "Oracle JDBC Driver version - 10.1.0.2.0"
Specification-Title: "Oracle JDBC driver classes for use with JDK1.4"
Specification-Version: "Oracle JDBC Driver version - 10.1.0.2.0"
Implementation-Title: "ojdbc14.jar"
Created-By: 1.2.2 (Sun Microsystems Inc.)
Implementation-Time: "Wed Jan 21 00:48:12 2004"
Implementation-Vendor: "Oracle Corporation"
Specification-Vendor: "Oracle Corporation".
It's a driver bug. Your version is already 6 years old. Download the latest and greatest from here.
See this post for a possible workaround.
For possible causes, see this thread:
There are bugs in different versions
of the drivers and different versions
of the database; most of them are
fixed in later versions.
For example, bugs produce the "Bigger
type length than maximum" in Oracle
database 8.1.7.2 or 9.0.1.1 for
certain very specific operations using
DB links; upgrading to 8.1.7.3 or
8.1.7.4 or 9.0.1.2 resolves those problems.
For example, bugs produce the "Bigger
type length than maximum" in Oracle
database 10.1.0.2 and 10.1.0.3 for
certain very specific operations
involving NLS characters; upgrading to
10.1.0.4 pr 10.2.0.1 resolves those problems.
For example, the 8.1.6 classes12.zip
had such a bug on certain operation
with databases in a UNICODE character
set, that was fixed in the 8.1.7.4
driver.
If you have an Oracle support
contract, you can find out this
information on the Oracle support
site; metalink.oracle.com If not,
download the latest versions of the
drivers and pray...
i downloaded the latest driver and now much better - now that all the referenced locations are updated
Another option than you can consider is review your query parameters, specially setFetchSize, if its too high this error is returned.
java.sql.SQLException: Bigger type length than Maximum
There is a maximun size depending on the database in my case 64kb (Oracle) my highest value have to be 65535
Reference document:
https://docs.oracle.com/cd/E11882_01/java.112/e16548/resltset.htm#JJDBC28621

dbExpress error in Delphi 2007

I have had Delphi 2007 for a while. I tried the Delphi 2009 trial. Then I un-installed the trial. Now I get this in a dbExpress Delphi 2007 application:
---------------------------
Debugger Exception Notification
---------------------------
Project ABC.exe raised exception class TDBXError with message
'Unable to load dbxora.dll (ErrorCode 126). It may be missing
from the system path.'.
---------------------------
Break Continue Help
---------------------------
I do not have dbxora.dll anywhere on my pc; I have dbxora30.dll, instead. Looking at another development machine (which has never had Delphi 2009 on it), I see dbxora30.dll too. FWIW, that file is here:
C:\Program Files\CodeGear\RAD Studio\5.0\bin\dbxora30.dll
And my path does include this location.
So it looks like Delphi 2009 introduced a new "dbxora.dll" which replaced "dbxora30.dll"... and when I un-installed Delphi 2009, it failed to point my system back to the original "dbxora30.dll". But now how do I use dbxora30 again?
Any suggestions?
I fixed the problem on my machine by editing this file:
C:\Users\Public\Documents\RAD Studio\dbExpress\dbxdrivers.ini
Under the section labeled [Oracle], I changed the "LibraryName" parameter from "dbxora.dll" to "dbxora30.dll".
I hope this helps someone else.
I had pretty much the same problem, though I installed the full Delphi 2009 along with the existing Delphi 2007 and found that it broke my previous exe files. I uninstalled Delpi 2009 but had to fix it by editing the same file (though it was in a different directory on my machine: C:\Documents and Settings\All Users\Documents\RAD Studio\dbExpress\dbxdrivers.ini). However, there were more lines than just the one that is mentioned above. Luckily, I had a backup of the ini file from before the Delphi 2009 installation. Here are the two sections in case anybody needs help with this:
[Oracle] - FROM DELPHI 2007
DriverUnit=DBXDynalink
DriverPackageLoader=TDBXDynalinkDriverLoader,DBXDynalinkDriver100.bpl
DriverPackage=DBXCommonDriver110.bpl
DriverAssemblyLoader=Borland.Data.TDBXDynalinkDriverLoader,Borland.Data.DbxDynalinkDriver,Version=11.0.5000.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
DriverAssembly=Borland.Data.DbxCommonDriver,Version=11.0.5000.0,Culture=neutral,PublicKeyToken=a91a7c5705831a4f
GetDriverFunc=getSQLDriverORACLE
LibraryName=dbxora30.dll
VendorLib=oci.dll
DataBase=Database Name
User_Name=user
Password=password
BlobSize=-1
ErrorResourceFile=
LocaleCode=0000
Oracle TransIsolation=ReadCommited
RowsetSize=20
OS Authentication=False
Multiple Transaction=False
Trim Char=False
Decimal Separator=.
MetaDataPackageLoader=TDBXOracleMetaDataCommandFactory,DbxReadOnlyMetaData100.bpl
MetaDataAssemblyLoader=Borland.Data.TDBXOracleMetaDataCommandFactory,Borland.Data.DbxReadOnlyMetaData,Version=11.0.5000.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
.
[Oracle] - FROM DELPHI 2009
DriverUnit=DBXOracle
DriverPackageLoader=TDBXDynalinkDriverLoader,DBXCommonDriver120.bpl
DriverPackage=DBXCommonDriver110.bpl
DriverAssemblyLoader=Borland.Data.TDBXDynalinkDriverLoader,Borland.Data.DbxCommonDriver,Version=12.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
DriverAssembly=Borland.Data.DbxCommonDriver,Version=11.0.5000.0,Culture=neutral,PublicKeyToken=a91a7c5705831a4f
GetDriverFunc=getSQLDriverORACLE
LibraryName=dbxora.dll
VendorLib=oci.dll
DataBase=Database Name
User_Name=user
Password=password
BlobSize=-1
ErrorResourceFile=
LocaleCode=0000
Oracle TransIsolation=ReadCommited
RowsetSize=20
OS Authentication=False
Multiple Transaction=False
Trim Char=False
Decimal Separator=.
MetaDataPackageLoader=TDBXOracleMetaDataCommandFactory,DbxOracleDriver120.bpl
MetaDataAssemblyLoader=Borland.Data.TDBXOracleMetaDataCommandFactory,Borland.Data.DbxOracleDriver,Version=12.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b

Resources