I am looking to run SQL queries using VBA code in an Excel file. It may sound like a bad way to do things, but the purpose of this is to support legacy functionality on a project I'm working on.
I figured out how to create an ODBC connection, but it requires several steps which may be troublesome to implement on many computers, so I'm looking into the possibility of using OLEDB to get the job done.
My question is how to go about setting things up so I can run SQL queries in Excel using VBA.
Both ODBC and OLEDB require data providers installed on the target machine. If by "several steps which may be troublesome" you meant installing these, there'll be a little difference.
Provided your target operating systems don't include Windows versions below XP, and your target database is in this list of databases supported by MDAC by default, then you won't have to do anything special. You'd create an ADODB.Connection object and open it using one of the connection strings.
Related
So I have a DataEase DOS 4.23 database, which I have full access to open and look at, and I'm looking to see if I can somehow convert this into a MSSQL or PGSQL (or any modern SQL, really) database. I've looked through this software, and I can't seem to find any sort of export function. I've found some documents that say to upgrade the system to 5.x, which has an export function, but I've had trouble locating an installer for DataEase 5.x.
Is there any known way to programmatically export the DQL to a more modern format? Even CSV is acceptable to me at this point.
I figured it out! Just had to use the wayback machine to find a program called Datagrab that some guy wrote in 2002, which only worked on XP and prior machines, so I created a VMware WinXP installation, transferred Datagrab and the database files to that machine, and was able to successfully transform the database tables into CSV files with only a few hundred errors (easily solved)!
Solved this with a program DataGrab.
In the link there is a newer software called ConvPlus, which has more features.
Both programs were tested on Windows 7 SP1 and have done their work
http://www.meltonisl.com/software.html
I'm looking to add some Access database functionality in a customer's Excel workbook app. Okay Excel & VBA aren't my first choice, but that is what we're working with.
Normally I use ADO through ADO.NET, so we always know the version because we've built for a specific version of .NET.
However with VBA and regular ADO, this is not the case.
Are the ADO libraries forward compatible? For example, if I referenced 6.0 would it work on everything from Vista onwards? (or 2.7 and XP)
Is there any way of doing this? Ie. referencing so that it will work on "all reasonably-installed versions". Or do I have to use late binding to ensure multi-version compatibility?
We need to support both 32 bit and 64 bit, so I'll be using ACE (and hence Access 2007 onwards). Waiting for confirmation on the XP - I suspect we can drop that too.
In my opinion you should use late binding in your situation. In such situation you can rely on compiler to use the most appropriate library available on computer where your code will be used.
I've been coding in objective-c in Xcode for just over 2 days now. So please forgive me if I'm being stupid at all. I am from a C# / .NET background and am looking to extend my current solution from Windows platforms to Mac. I've searched far and wide for an answer to this requirement, and all I came up with is 'create a consumable web-service'. However, I don't want to do this.
So far, my application can parse JSON and send in via command line. One of the objects in the JSON is the SQL connection string. Now I need to be able to:
Create an open connection to a simple SQL Azure database, based on the NSString containing my SQL connection string
Execute a query, with parameters
Close and dispose of the SQL connection
Any and all help is appreciated
For talking to an SQL server from a Mac, you're going to need to have an appropriate ODBC driver, or a set of libraries that works directly with objective-c (or c).
ODBC isn't particularly well supported by OS X, so I'd avoid it unless you can find a tested and installable ODBC driver to work with it. With that said, we do make use of it in our products to talk to other (non-Azure) SQL databases and have found it stable and useful, as long as the drivers are good.
Otherwise, you're going to need to seek out an SDK that will work for you. As far as I can tell, they've open-sourced most of their SDK on github, but there isn't an OS X version there.
Thanks for your answer, and even though it does point me in the right direction, as you correctly stated, there is no OSX driver for Azure from Microsoft.
Because of this reason, i feel the original question, to connect to a SQL Azure database, has not been answered.
I believe the best, and correct, way to proceed is to do what i originally did not want to do and set up a consumable web-service for the DB calls my application required.
My apologies for not up-voting your response sooner, it was an oversight, I did not intend to be rude.
Thanks again for your reply gaige
I am just wondering that whether there is any utility which can help in determining the spelling mistakes in sql objects.
I can only think of getting information of all the sql objects and the save them in any other system (e.g. excel file) and then run a spell checker on it.
I am looking forward for a better way for this, like any plugin for MSSQL.
You can use spell check functionality built in Office as CLR function. Example see here:
http://msdn.microsoft.com/en-us/library/office/aa537153%28v=office.11%29.aspx
To use this, you need MS Word to be installed on server side.
Does anyone know how to connect to an ODBC database in Octave? The database package doesn't seem to install properly. I found this bug here:
http://savannah.gnu.org/bugs/?30090
Is there any other method? I am actually trying to connect to SQL Server and am using Windows 7 (not linux unfortunately, at my work place!).
If not, are there any other matlab type programming environments out there that anyone would recommend?
A looong time ago I wrote a connector for Octave to PostgreSQL (which is still on its webpage here). Maybe you could use that a starting point?
Taken from a reply by Martin Helm to the same question on the Octave forum which suggests using Java plus JDBC. -
Look at the java bindings in the octave java package (octave-forge), it is
maintained and it works. Java is very strong and easy for database handling.
Use that and jdbc driver for mysql to connect to mysql (or with the
appropriate jdbc driver everything else which you can imagine). That is what I
do when using db queries from octave. Much easier and less indirect than
invoking scripts and parsing output from databse queries.
As far as I remeber the database package is somehow broken (at least I never
was able to use it).
I also have this problem and will be giving this a try.