Important alert: (current site time 7/15/2013 12:45:41 PM EDT)
 

article

Daffodil DB: Web Database

Email
Submitted on: 6/1/2005 6:28:56 AM
By: Sachin Garg  
Level: Advanced
User Rating: By 3 Users
Compatibility: JavaScript
Views: 7591
(About the author)
 
     A web database is a database for the internet. You can get access to your data via the internet from anywhere in the world. Or, you can create a database driven website by using such databases. A web database stores large amount of information in an organized format that is easily accessible from scripting languages (like PHP).

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
  1. You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
				What is a Web Database? 
A web database is a database for the internet. You can get access to your data via the internet from anywhere in the world. Or, you can create a database driven website by using such databases. A web database stores large amount of information in an organized format that is easily accessible from scripting languages (like PHP). 
In web databases, modifications, like the ones constantly used by e-commerce sites, for example, can be performed without any hassles .That makes the dense editing of the html code obsolete. Repeated types of data, like contact information, can be generated automatically in your website through a web database.
Daffodil DB: A web database 
Daffodil DB is a J2EE-certified, SQL-99 and JDBC standards compliant Java RDBMS. It is the first java database which is compatible with PHP. With the release of PHP extension module, Daffodil DB has joined the select list of Java enabled web databases. 
Daffodil DB is an ideal for anyone who is looking for a web database. It can be embedded within any application and delivers high performance with minimum system resource usage - thereby striking the right balance between size, features and performance. At less than 3 MB, Daffodil DB is a small/compact database. 
Daffodil DB can run on virtually any platform as it supports all platforms for which a Java Virtual Machine (JVM) is available. These include Windows, Linux, Solaris and UNIX. With the help of Daffodil DB, developers can build applications for any platform and these can be compiled and delivered on all other major platforms. 
PHP 
PHP ( PHP Hypertext Preprocessor) is an open source server-side scripting language that is particularly suited for web development and can be used to generate dynamic web content. 
PHP scripts are embedded within web pages along with HTML, similar to other web scripting languages such as Microsoft's ASP or Sun Microsystems's JSP. Like ASP and JSP, PHP runs on the web server when a page is requested via HTTP, rather than on the Web browser or other client. 
PHP lets you insert instructions into your Web pages that your Web server software (be it Apache, Personal Web Server, or whatever) will execute before sending those pages to a browser that requests them. 
PHP is easy to use for web development because it has been designed from the onset for the web environment. PHP has many built-in functions that make web programming simpler, so that programmers can focus on the logic of programming without wasting precious development time. 
PHP as a language has its own way of doing things, and at the same time, has borrowed features from other languages. But for many people, the main reason for learning a scripting language like PHP is because of the interaction with databases it can offer. Moreover, PHP is cross platform i.e. it allows you to use/develop your solution on multiple OSs . 
PHP is one of the fastest growing server side scripting languages around and you need to add it to your current arsenal of Perl, ASP, JSP, JavaScript, VBScript, Java... 
PHP and Daffodil DB: Together?? 
Daffodil has come up with a PHP extension module that makes Daffodil DB/One$DB compatible with PHP. It is a database extension module driver that is required to work with Daffodil DB in PHP . This extension module uses the capabilities of a Java database and extends it to your web infrastructure. 
By using this extensive module, PHP developers can create sophisticated data-driven web applications, having Daffodil DB as a web database, in a fraction of the time and with reduced cost. 
PHP extension for Daffodil DB provides a simple, yet effective means for connecting to Daffodil DB from within PHP. The JVM is created using JNI invocation interface and everything runs in-process. 
This PHP Extension module will boost open Source activities around Daffodil DB. Moreover, open Source stack -Linux, Apache, One$DB, and PHP; all being open source products, will give an ultimate combination to web development community. 
PHP is platform independent, Daffodil DB is platform independent. PHP is free; so as Daffodil DB (open source version).PHP is open source; Daffodil DB has an open source version. So What about using the powers of two most promising technologies, PHP and Daffodil DB, together?? 
The capabilities of Daffodil DB & PHP can make up what must be the best blend for data-driven Web sites on the globe. 
Users can use PHP and the Daffodil DB database to access/store information on the web and include it into their website. By using PHP as a front-end and Daffodil DB as a back-end web database, users can benefit from huge savings on the licensing costs of commercial alternatives. 
Here are some practical examples where PHP and Daffodil DB, used together, can do wonders 
Designing a database driven website
Any site that successfully attracts repeat visitors has to have fresh and constantly updated content. But this can be very tedious if your have a HTML based website. Moreover, the maintenance of a content-driven site can be a herculean task too. Many sites feel locked into a dry because rewriting those hundreds of HTML files to reflect a new look would take a long time. The solution of this problem is a database driven site. 
In a database driven website, you have a web page that grabs information from a database (the web page is connected to the database by programming.) and inserts that information into the web page each time it is loaded. If the information stored in the database changes, the web page connected to the database will also change accordingly and automatically without human intervention. 
This is commonly seen on online banking sites where you can log in (by entering your user name and password) and check out your bank account balance. Your bank account information is stored in a database and has been connected to the web page with programming thus enabling you to see your most updated banking information every time u access the site. 
 
Add, edit & delete Web site content without using HTML
One great thing about a database-driven site is that it keeps your site design and content separate with each other. By achieving complete separation between your site's design and the content you want to present, you can work with each without disturbing the other. Instead of writing an HTML file for every page of your site, you only need to write a page for each kind of information you want to be able to present. Rather then endlessly pasting new content into your tired page layouts, create a simple content management system that allows the writers to post new content themselves without a lick of HTML! 
If you have a large website and you want to change the design it can take a very long time to update and upload all the pages. With PHP and Daffodil DB your whole website could be managed in just one or two PHP scripts. These would access a Daffodil DB database to get the information for the pages. To update the website's design you would just have to change one page. 
Banner Rotation 
Banners can be found on any dynamic website, as moving text attracts the visitor of a site more than a static text. But a million dollar question is how these banners work. Actually, on a site where there is a banner running, a PHP script is called. This script opens a database and picks a random banner from it to show the visitor. It also counts the number of times the banner has been viewed and could, with a few changes, track clicks too. To add, change or edit the banners all that one need to do is just change the database and the script will pick the correct banners for all the pages on the site. 
Forums 
Forums/ message boards are among the most widely used applications of the internet. Now how do they work? Well, PHP magic again..!!! , and not to forget a web database is also needed to create such magic. These forums can be created using PHP and Daffodil DB. All the pages in the forum can be updated, whenever needed, by changing just one PHP script. 
Apart from all above mentioned applications, there are some more areas where users can use Daffodil DB-PHP 'dynamic-duo'. 
* Optimize the loading time of the website
* Build an ecommerce shopping cart 
* Automatically send email on triggered events 
* Handle file uploads using HTML forms 
* Build a Web-based file repository or photo gallery 
* Utilize sessions and cookies to track site visitors 
Go Ahead: Give it a try 
So now you are aware of both Daffodil DB and PHP, and what they can do, if used together. It's the time to try your hand on some simple PHP scripts. 
Writing your first PHP Script 
Writing your first PHP script may seem a little scary at first, but relax. It's really easy. Here is the code for your first simple PHP script. 
 
 < head > 
 < title>My first PHP script 
  
 < body > 
 Welcome to PHP

'; ?> Make a Connection to a Daffodil DB database from PHP: The following sample code makes a connection to a Daffodil DB database from PHP and executes a simple query that fetches the data from the database and displays it. The example assumes you have a Daffodil DB user called "DAFFODIL" who can connect with a password "daffodil" from the server "127.0.0.1" on port no 3456. ".daffodildb_field_name($rs,$index+1); } while($record = daffodildb_fetch_array($rs,DAFFODILDB_NUM)){ for ($index = 0; $index < $column_count; $index++) { echo ".$record[$index]"; } } ?> Congratulations! You just wrote your first PHP script. These were the two basic scripts for giving you the basic idea of how to go about using PHP and Daffodil DB together. Now you can look forword to use both these technologies in developing your web applications. To know more about PHP visit http://www.php.net For more information about Daffodil DB log on to http://www.daffodildb.com/daffodil-php.html Please log on to http://cvs.php.net/co.php/pecl/daffodildb for more information on PHP and Daffodil DB.


Other 6 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Advanced category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

5/29/2008 12:15:33 AMvishal

excellent coding
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.