If you'd like to see the pieces that make up AirDBC, this guide will show you how to get started.
I would first like to thank Sean Fujiwara for the excellent tutorial he did on building an AIR3 native extension http://blog.magicalhobo.com/2011/09/12/air-3-native-extension-imageprocessor/. His example got me further along the road of realising AirDBC than would have been possible otherwise.
You'll also notice that the AirDBC steps are very similar.
- Visual C++ 2010 Express
- AIR3 SDK for Windows from Adobe Labs
- Flash Builder 4 (any OS)
- .NET 4.0 Framework
My build platform in a Mac, but I am using a Windows XP Parallels VM to do the Window specific features. To actually complete the build I required both the Windows and Mac downloads of the AIR3 SDK. If you're working entirely within Windows, then obviously you won't need the Mac stuff.
Flex 4.5.1 + AIR 3.0
As this is early days for Native Extensions, to build the Demo app requires that you overlay the AIR3 SDK over an existing Flex 4.51 SDK. Do this on the Platform that you have Flash Builder running on.
Follow the instructions on this Forums posting
The demo app is built with the SDK with the name "Flex 4.5.1 + AIR 3.0" - if you make your's different, you'll just need to update the Flex Builder projects later on. Ensure you add your newly created SDK into Flash Builder.
All the code is on GitHub. Pull it all from my repository https://github.com/philhaeusler/AirDBC
There are two placeholder files in the Native Extension that are copyright by Adobe. Once you get the project locally, you have to replace these placeholder files from the AIR3 SDK.
You can run the windows batch file AirDBC/AirDBCExtension/setup.bat which will copy the files from the AIR SDK. This script does the following:
- Copy the file AIR_SDK/include/FlashRuntimeExtensions.h to AirDBC/AirDBCExtension/AirDBCExtension/FlashRuntimeExtensions.h
- Copy the file AIR_SDK/lib/win/FlashRuntimeExtensions.lib to AirDBC/AirDBCExtension/AirDBCExtension/FlashRuntimeExtensions.lib
Once you've done that you should be ready to start building.
Building the Native Extension DLL for Windows
Open the Visual C++ 2010 Express project AirDBC/AirDBCExtension/AirDBCExtension.sln
Build the DLL (F7)
You should now find the file AirDBC/AirDBCExtension/Debug/AirDBCExtension.dll built successfully
Building the Flash Native Extension
Using Flash Builder import the AirDBC/AirDBC project. This can be on Windows or Mac
Ensure the Project Properties > Flex Library Compiler > SDK is set to your freshly built "Flex 4.5.1 + AIR 3.0" SDK
Build the SWC
Now outside of Flash Builder open the AirDBC.swc with a .zip editor, and extract library.swf to the same folder as the AirDBC.swc
From the command line, build the Native Extension by running AirDBC/AirDBC/bin/package.bat (windows) or AirDBC/AirDBC/bin/package.sh (mac)
You should now find the file AirDBC/AirDBC/bin/AirDBC.ane built successfully
Building the Demo App
Import the AirDBC/AirDBCDemo project into Flash Builder. This can be on Windows or Mac.
Again ensure the Project Properties > Flex Library Compiler > SDK is set to your freshly built "Flex 4.5.1 + AIR 3.0" SDK
Build the SWF
From the command line, now build the native installer. This step can only be done on Windows. Run AirDBC/AirDBCDemo/bin-debug/package.bat.
You should now find the AirDBC/AirDBCDemo/bin-debug/InstallAirDBCDemo.exe
Run the installer and start the app. Click to Run the sample query. 4 records are returned. Feel free to modify the underlying demo.mdb database in Access and then querying it using the Demo app.
AirDBC allows AIR3 apps running on Windows to access any ODBC data source.
I'm working towards an initial release of the SWC along with an app to demo the functionality. I think it might be kind of useful so it'll all be going up on Github.
So what can you do with it? Well here's a screenshot of the AIR demo app querying an Access database. Hopefully it will give you the idea.
AirDBC is a Native Extension for AIR3, coded in Visual C++ and uses of the .NET Framework 4.0 for Data Access. I initially see it providing me the ability to deliver rich user-interfaces to existing Access driven desktop applications. It would then further allow migration of those Access DBs into SQLLite, and beyond that opening them up to web/cloud based options.
But beyond access, i see a huge potential in being able to deliver standalone desktop apps that connect directly to any database without the need to proxy through a web service. It really will simplify bringing line of business applications into organisations.
I hope that opens up a whole new raft of opportunities to AIR applications and, more importantly, for AIR developers.