Flash and database integration - database

I recently had a couple of flash products to do, which basically were a clients for some database (online games, movie players). In all of them I used PHP + MySQL as the server database and then made the flash client application work with those databases.
This was ok, but I'm somewhat interested if there is some other choice except PHP + SQL database for the server backend, which would be, like, more Flash-oriented or something (easier to deploy, etc).
Does someone know what can I use for that?
Thank you.

Any server script & database will work with flash. The URLLoader works with any HTTP request. All it's doing is making a request to the server for data.
IMHO PHP + MySQL is the way to go, but you could choose Python or Perl or ASP.net, with Oracle, or DBase, or whatever.
Flash has a nice implementation of XML, so passing data via XML works great. If your data doesn't change very much/often (or even if it does) you can generate static XML files for the flash player to hit. If it's content that changes often, then you'll want to request data directly from the server script.
Just make sure that you send the correct mime type from the server, so that the flash script will know what to do with the data.

I've personally really liked using PHP and MySQL as the backend for a lot of the mom and pop applications/websites I've done, and it serves it's purpose. XML is after all pretty easy to read so debugging is generally not too troublesome.
I think what you're after though is AMF (actionscript message format) this is the serialized version (if you're unfamiliar with the term basically the binary form of the object) of plain old actionscript objects, you can use BlazeDS (free from Adobe) as a component to the server. In big projects I've used some sort of J2EE server (like Websphere or Apache Tomcat), BlazeDS, Spring, and iBatis (Teradata DB sitting behind it but who cares :) ) with some pretty awesome success (setting up this sort of environment isn't trivial though... taken piece by piece it can be done and using build tools like maven makes life easier).
If you've got the gut for it I would recommend this route:
http://code.google.com/p/maven-blazeds-spring-archetype/
Alternatively check out amfphp a php backend that supports AMF or other AMF libraries for your language of choice, it's all very decoupled and each piece can be chosen based on what suits your needs best.

Related

How to setup an online database for my cross-platform games?

How to setup database whose data can be obtained by my cross-platform games (Flash on Kongregate, Flash and JavaScript on my WordPress page, Android and iOS) and my WordPress page as well? The data to be saved are gameplay count (total and for each platform) and high scores.
I have no experience about this database thing.
And my games will be made in Haxe.
You will want to have a redundant Database, preferably mysql. You can access a mysql database from almost any language / script.
Before you start that Project heads in have a look at what you need. I personally learn the best, if i find myself some example code, take it appart, look at each function if i don't know it already and then i try to find new ways of doing it with the functions provided.
Sqlite Database helper is a great start to create unlimited Databases just to see, how that works, how it looks inside a database, what is a primary key etc. You could even import the whole database to mysql, if you're very happy with it.
Choose a database of your choice, it could be mysql or mongodb.
Choose a server language of your choice and build a HTTP API to access your db. If you are using Haxe to build the server, you may want to target neko or php if you choose mysql as your db, or nodejs for mongodb. Because Haxe has mysql support for neko & php, and you can download mongodb drivers from npm if you choose mongodb and nodejs.
Then, from your games, just use the Http class provide in the Haxe standard library to access your Http API to get the data from your db.

How to develop a simple database based project

I want to start an information provider service. It works this way:
Some employees will find the information needed and fill a database manually.
Users will request data they need on their client side apps on their own platforms. Some of the project specifications is as follows: 1) Data that will go between database server and clients is really small(Suppose some ordinary images). 2) The client side apps don't need to be kept updated. Once the user of app clicks update button(for example) the app will request the server to send required information. 3)It's important to run client side apps on several platforms like: windows, windows phone, android, ios,... 4) Database doesn't need to be vary fast or vary big.
Note: And It's important to note that I'm not expert and I have some limitations. I know java and html, css, javascript. But I think those are enough for this project. (Am I right?)
So I decided to design this development architecture:
1)Using hibernate and provide a layer for server which stands above hibernate and is used to do database-specific tasks. This layer provides some protocols for client side apps to communicate with server. It enables me to change database later without changing client side apps. 2)Using PhoneGap which is a framework that uses html, css, javascript and produces apps for many platforms.
I really appreciate any suggestion, comment,... Thanks!
The fastest way in Java world would be spring boot. Basically you can configure whole application: datasource, orm, persistance layer and rest services just by adding proper annotations. There are many examples of how to do it. Basically with current implementation of spring jpa and web services you can bind mapped resources to rest services. Also current JPA can generate SQL for you using DAO method name. SO e.g. findPersonByName will generate proper sql for you (of course you need to map your db model in entities but this is also simply done with annotations).
Yes, this is a sufficient tech stack to accomplish your goal. You will have to decide how much logic to implement server-side vs app-side.
Pick a java framework for providing an API so that you can expose a restful API to your apps.
Here are a couple of comparisons from stack overflow:
Which is the best Java REST API?
Easiest frameworks to implement Java REST web services
no! for database you need server side scripting language, like php or perl, java-script is client side and will only work on browser. i recommend first learning mysql database, just the basics how to create Db, table, insert and fetch. then some PHP. i think these will set the ground for your project. '
for development environment : download XAAMP! it comes complete with Sql-database base and PHP.

Is it possible to connect Adobe Flash CS to Database of any kind?

Can I build flash application that connects to database? (MySQL)
For example: Photo Gallery that brings me the photos from database...
Or Music Player...
Maybe PHP? :-)
AMF is a technology that allows a Flash app to execute remote code. Server side implementations exist for a number of server side environments and languages, check out the list in the wikipedia article.
Simple answer: yes.
As fvu mentioned, you can get into AMF which is an excellent choice for heavy lifting, but it's not required.
Using combinations of URLRequest, URLLoader and URLVariables it is very easy to send and receive data in HTTP requests, which then frees you to employ whatever server-side solution you prefer. The data format you choose is then also up to you; Flash natively supports XML, and full JSON support is found in as3corelib.
Perhaps Adobe FlashBuilder (formerly FlexBuilder) is something that would interest you.

Is it possible to create a database driven website with flash?

I am a newbie programmer and i dont yet have any idea of the WEB. I wish to start learning a technology that will allow me to build websites( database driven) i dont know which one to choose. I know some actionscript3 and flash.
Is it possible to create a database driven website using these alone? Or do i need to learn any other technology? If i do then what should i learn? I know j2se for the desktop and oracle SQL/MySQL
please show me a path. Also wanted to know if there is any technology like Wordpress for J2EE/flash
OK so i finally got the feeling that i need to learn PHP anyway along with css and javascript. So it is fine. Also another query. Which CMS should i consider? Wordpress or Joomla?
You can develop a database driven website using Flash, but only in the same sense that you can develop a database driven website using AJAX. That is, you can build the front-end using Flash/ActionScript but the back-end is built using other technologies. Just like working with JavaScript to develop a front-end, from ActionScript you would be communicating with Java or PHP or Python or something on the server using RESTful calls and then actually working with the database in the server-side scripts.
Honestly = this question is too broad and generic, and answers are easily found with some google searches.
That being said = of course you can build a data driven flash site. The one caveat here is that flash itself is fundamentally client-side technology, so we must rely on other remote tech to do the heavy data lifting. The options are profuse.
For example, a developer might create a front facing presentation in Flex, which is the streamlined, data-centric extension of pure flash. His database interactions are written in php, and these are constantly called upon to deliver content to the user.
So - what technologies to use? Whatever you know. And if you don't know, then learn the ones that are closest to what you know.
Finally, although I am a die-hard fan of flash, this type of project (you didn't specify what you had in mind) could be done with many different technologies. So - maybe flash is the right answer, but maybe javascript (ajax) could manage the same thing and do it without the need of plugins.
Yes you can develop database driven site in flash/action script but you still need and back-end technology i recommend you to check WebORB you can develop the back-end using Java, PHP, or .NET In addition you can use Flash Remoting technology Flash/Flex to communicate with a back-end
Flash can't be directly connected to database. You must use another technique which would be "mediator". I have developed Flash game with MySql database and PHP and I recommend you to use this combination. Here is visually presented this kind of communication: http://www.youtube.com/watch?v=gRi-oxjFfCU
yes, it is possible to crate database driven website with flash and action-script. You would get an XML file when you do action script in flash, so you can store nodes of that XML file into database(mysql). You can then create an Admin interface to manage your database contents, that would indirectly change your xml nodes. So basically you can edit the xml file and store it in the database.

Query SQL Server Database from native iOS Application

I am working on an in-house, iOS app that will need read-only access to a SQL Server with multiple databases. I know the stock answer here is "write some web services", but I'd like a solution that is self-contained. Is there any way to directly connect to a SQL Server database from an iOS application? I'm thinking something like a basic ODBC connection.
I've seen a lot of users asking this question, but very few answers other than "write a web service." Is that really the only way?
A web service is indeed the only way, but Red Gate's written one you can reuse:
http://www.mobilefoo.com/iSqlServerSDK.html
http://labs.red-gate.com/Tools/Details/iSqlSDK
It's not officially released yet, just in beta, so keep in mind that features & prices may change.
Actually the easiest way is to create a MVC 3 or 4 asp.net web application. call the web methods. You don't need any API to pay for.
I use SBJson to serialize domain object and then send the objects as serialized jSOn to MVC 3. It's super easy to do. I even send images with base64, so it's .net compatible.
See my blog post with sample code:
http://nickturner.wordpress.com/2012/10/09/107/
So, after much searching and trial and error, unfortunately the best (only?) way I've found is indeed using Web Services.
Fortunately, Linq to SQL makes the WCF-creation-side incredibly easy. Once I got someone at work to walk me through setting up a Windows web server and adding the web service (and buying access to an online web server), the Windows side was up and ready to go.
I'm still working through all of the syntax stuff on the SOAP interaction side, but keeping my different methods somewhat similar in structure allows me to tinker a little until it works. By this time, I think I've gotten it to work pretty well.
So, both answers I got back were (disappointingly) correct. The only way to interact is through a Web Service. Even the 3rd party solutions they mentioned were really just convenient wrappers around the same type of technology. As it turns out, I'd rather have finer control over the process.
One word of advice: Get a real, external web server. I tried doing this on a non-Server Windows VM on my iMac/MacBook Pro, and it was like pulling teeth! Once I actually got access to an external, full, stand-alone web server, the process was much more streamlined and easy. Do yourself a favor and take that headache out of the equation!
There was a SQL ISAPI extension as part of SQLXML, but I think it has been deprecated: http://msdn.microsoft.com/en-us/library/aa226559%28v=SQL.80%29.aspx
This was effectively a pre-built, and relatively open, web service - so I'm not sure this counts as a direct connection.
You could also check out http://odbcrouter.com/Main

Resources