1
votes

I'm trying to include a database un flex4 (flashbuilder) project, i don't see data and SQL packages in the import? What might be the reason? Should i add external library?

        import flash.data.SQLConnection;
        import flash.data.SQLStatement;
        import flash.events.SQLErrorEvent;
        import flash.events.SQLEvent;

Description Resource Path Location Type 1172: Definition flash.data:SQLConnection could not be found. EyeVision1.mxml /EyeVision1/src line 28 Flex Problem

2
Is this an AIR project? I don't see it in the tags. Those classes are AIR only.RIAstar
No its for flashbuilder project. Can't i use database connection in normal web based flashbuilder project?Abhilash Muthuraj
No you can't, unless you use a web server as a gateway but you can't make a connection directly from flash to a DB server.Kodiak
You can connect the database directly from flex. You may have a look to my answer.michael

2 Answers

3
votes

You can use those classes only in an AIR project, not in a web-based Flex project. AIR comes packaged with a SQLite database to which you can connect using these classes.

A Flex web-based application runs on the client not on a server, so if you want to access a database on the server you'll have to use a server side language to do it and pass the results to the Flex app on the client side. If you want to access a local database, well... you can't (except perhaps using HTML5 local storage and ExternalInterface).

0
votes

You can connect the database directly from flex but this is not recommended because of the security reason.

You may try asSQL to do so.

Have a look on the following question:

Connecting any database directly from flex