<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>PlanetMysql.ru - информация о СУБД MySQL &#187; sakila</title>
	<atom:link href="http://planetmysql.ru/category/sakila/feed/" rel="self" type="application/rss+xml" />
	<link>http://planetmysql.ru</link>
	<description>Блог о самой популярной СУБД MySQL</description>
	<lastBuildDate>Thu, 24 May 2012 22:24:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Rediscovering the roots.</title>
		<link>http://mysqlpreacher.com/wordpress/2010/08/thought-you-might-be-interested/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rediscovering-the-roots</link>
		<comments>http://mysqlpreacher.com/wordpress/2010/08/thought-you-might-be-interested/#comments</comments>
		<pubDate>Sat, 28 Aug 2010 12:22:54 +0000</pubDate>
		<dc:creator>Darren Cassar</dc:creator>
				<category><![CDATA[dolphin]]></category>
		<category><![CDATA[logo]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sakila]]></category>

		<guid isPermaLink="false">http://mysqlpreacher.com/wordpress/?p=435</guid>
		<description><![CDATA[Do you ever stop and think? It happens to me all the time, random subjects kick in and I end up searching (aka googling) and today I wondered &#8230; Why is MySQLs logo a dolphin? Shame on me it took me so long to ask the question but as the saying goes, better late than never.
As per MySQLs own article:
&#8220;We&#8217;ve been discussing a new logo for at least a year&#8221;, says main developer and MySQL AB founder Michael &#8220;Monty&#8221; Widenius. &#8220;I am personally concerned about the survival of endangered species, and I liked the idea of the dolphin as soon as it came up. It combines great symbol value with a powerful, modern design.&#8221;
After a while the name was chosen out of 6357 suggestions by the community and that is how Sakila the dolphin came to be :) &#8230;. and we lived happily ever after (or at least hope to!)]]></description>
			<content:encoded><![CDATA[<p>Do you ever stop and think? It happens to me all the time, random subjects kick in and I end up searching (aka googling) and today I wondered &#8230; Why is MySQLs logo a dolphin? Shame on me it took me so long to ask the question but as the saying goes, better late than never.</p>
<p>As per MySQLs own <a href="http://www.mysql.com/news-and-events/generate-article.php?id=77" >article</a>:<br />
&#8220;We&#8217;ve been discussing a new logo for at least a year&#8221;, says main developer and MySQL AB founder Michael &#8220;Monty&#8221; Widenius. &#8220;I am personally concerned about the survival of endangered species, and I liked the idea of the dolphin as soon as it came up. It combines great symbol value with a powerful, modern design.&#8221;</p>
<p>After a while the name was chosen out of 6357 suggestions by the community and that is how Sakila the dolphin came to be :) &#8230;. and we lived happily ever after (or at least hope to!)</p><br/>PlanetMySQL Voting:
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=25694&vote=1&apivote=1">Vote UP</a> /
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=25694&vote=-1&apivote=1">Vote DOWN</a>]]></content:encoded>
			<wfw:commentRss>http://planetmysql.ru/2010/08/28/rediscovering-the-roots/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back to blogging&#8230;.</title>
		<link>http://rpbouman.blogspot.com/2010/08/back-to-blogging.html?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=back-to-blogging</link>
		<comments>http://rpbouman.blogspot.com/2010/08/back-to-blogging.html#comments</comments>
		<pubDate>Tue, 10 Aug 2010 23:05:00 +0000</pubDate>
		<dc:creator>Roland Bouman</dc:creator>
				<category><![CDATA[Chrome]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[Freebase]]></category>
		<category><![CDATA[Indexed Database API]]></category>
		<category><![CDATA[Kettle]]></category>
		<category><![CDATA[Kettle Solutions]]></category>
		<category><![CDATA[kettle-cookbook]]></category>
		<category><![CDATA[MQL]]></category>
		<category><![CDATA[mql-to-sql]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[pentaho data integration]]></category>
		<category><![CDATA[Quipu]]></category>
		<category><![CDATA[Safari]]></category>
		<category><![CDATA[sakila]]></category>
		<category><![CDATA[sqlite]]></category>
		<category><![CDATA[Web SQL Database API]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[It has been a while since I posted on my blog - in fact, I believe this is the first time ever that more than one month passed between posts since I started blogging. There are a couple of reasons for the lag: Matt Casters, Jos van Dongen and me have spent a lot of time finalizing our forthcoming book, Pentaho Kettle Solutions (Wiley, ISBN: 978-0-470-63517-9). The book is currently being produced, and should be available according to schedule in early September 2010. If you're interested, you might like to read one of my earlier posts that explains the organization and outline of the book.(I should point out that we have reorganized the outline as the project progressed, so the final result will not have all the chapters mentioned in that post. We do however cover most of the topics mentioned.)I have been checking out Quipu, a promising Open Source data warehouse management solution. Quipu provides a repository-based extensible code-generator that allows you to generate and maintain a data warehouse based on the Data Vault model. One of the things I want to do in the short term is write templates that allows it to work for MySQL, and after that, I want to see if I can get Quipu to generate Kettle Jobs and transformations.I have been working on a couple of software projects. Two of them are currently available as open source on google code:mql-to-sqlThis allows you to use the Metaweb Query Language (MQL) to query a RDBMS. If you're wondering what this is all about: MQL is the query language used by Freebase (which is a collaborative "database-of-everything" or "wikipedia-gone-database").While Freebase is interesting in its own right, I am particularly enthused about the MQL query language. I feel that MQL is an exceptionally good solution for flexible, expressive and secure data access for modern (AJAX) Web applications. Even though MQL was not developed with relational database systems in mind, I think it is a pretty good fit.Anyway, this is very much a work in progress, and I appreciate your feedback on it. If you're interested, you can read a bit more about my take on RDBMS data access for web applications and MQL on the mql-to-sql project home page. I have also put up an online demo that allows you to query the sakila MySQL sample database using MQL.kettle-cookbookThis is a project that provides auto-documentation for Kettle (a.k.a. Pentaho Data Integration). The project consists of a bunch of Kettle Jobs and transformations (as well as some XSLT stylesheets) that extract data from Kettle Jobs and transformation and transform it into a collection of human-readable HTML documents along with a table of contents. The resulting documentation looks and feels a bit like JavaDoc documentation. If all goes well, I will be presenting kettle-cookbook in a Pentaho web seminar, which is currently scheduled for September 15, 2010I've been enjoying 4 weeks of vacation (I started working this week). There's not much to tell about that, other than that it was great spending a lot of time with my family. I plan to do this more often, and now that Kettle Solutions is finished I should be able to find more time to do it.I've been looking at two emerging HTML5 APIs for client-side structured storage, the Web SQL Database API and the Indexed DB API. I have developed a few thoughts about the ongoing debate (see this and  article for some background) about which one is better and I see a role for something like MQL here too. I will probably write something about this in the next few weeksYesterday, I got wind of the JS1k contest! Basically, the challenge is to write an interesting standalone JavaScript demo program that must be no larger than 1024 bytes. It is amazing and inspiring to see what people manage to do with a modern browser in 1k of JavaScript code. I decided to try it myself, and you can find my submission here: An interactive SQL query tool for the Web SQL DB API. Essentially, you get a textarea where you can enter arbitrary SQLite queries, and button to execute the SQL, and a result area that will print a feedback message and a result table (if applicable). As a bonus, there's a button to get a listing of the available database objects (using a query on sqlite_master) and an explain button to show the query plan of the current SQL statement.The demo works on recent versions of Google Chrome, Apple Safari and Opera. It can run offline, and does not require any plugins. I should say that I expect my submission will be rejected by the judges since the demo is not functional on Mozilla Firefox, which is a requirement. (That is, the script will detect that the Web SQL Database API is not supported and print a message to that effect). However, it was still fun to try my hand at it. Ok - that's it for now. I will try and post more regularly and write about these and other things in the near future. Don't hesitate to leave a comment if you have any questions or suggestions.]]></description>
			<content:encoded><![CDATA[It has been a while since I posted on my blog - in fact, I believe this is the first time ever that more than one month passed between posts since I started blogging. There are a couple of reasons for the lag: <ul><br /><li><a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470635177.html" ><img src="http://media.wiley.com/product_data/coverImage/77/04706351/0470635177.jpg" /></a><a href="http://www.ibridge.be/">Matt Casters</a>, <a href="http://www.tholis.nl/">Jos van Dongen</a> and me have spent a lot of time finalizing our forthcoming book, <a href="http://www.wiley.com/WileyCDA/WileyTitle/productCd-0470635177.html" >Pentaho Kettle Solutions</a> (Wiley, ISBN: 978-0-470-63517-9). The book is currently being produced, and should be available according to schedule in early September 2010. If you're interested, you might like to read <a href="http://rpbouman.blogspot.com/2010/03/writing-another-book-pentaho-kettle.html">one of my earlier posts</a> that explains the organization and outline of the book.<br /><br />(I should point out that we have reorganized the outline as the project progressed, so the final result will not have all the chapters mentioned in that post. We do however cover most of the topics mentioned.)</li><br /><li><a href="http://www.datawarehousemanagement.org/" ><img src="http://www.datawarehousemanagement.org/Portals/0/Quipu%20400%20lime%20smaller_resize.png" /></a>I have been checking out <a href="http://www.datawarehousemanagement.org/">Quipu</a>, a promising Open Source data warehouse management solution. Quipu provides a repository-based extensible code-generator that allows you to generate and maintain a data warehouse based on the Data Vault model. One of the things I want to do in the short term is write templates that allows it to work for MySQL, and after that, I want to see if I can get Quipu to generate Kettle Jobs and transformations.</li><br /><li>I have been working on a couple of software projects. Two of them are currently available as open source on google code:<dl><br /><dt><a href="http://code.google.com/p/mql-to-sql/">mql-to-sql</a></dt><dd>This allows you to use the <a href="http://wiki.freebase.com/wiki/MQL">Metaweb Query Language</a> (MQL) to query a RDBMS. If you're wondering what this is all about: MQL is the query language used by <a href="http://wiki.freebase.com/wiki/Main_Page">Freebase</a> (which is a collaborative "database-of-everything" or "wikipedia-gone-database").<br /><br />While Freebase is interesting in its own right, I am particularly enthused about the MQL query language. I feel that MQL is an exceptionally good solution for flexible, expressive and secure data access for modern (AJAX) Web applications. Even though MQL was not developed with relational database systems in mind, I think it is a pretty good fit.<br /><br />Anyway, this is very much a work in progress, and I appreciate your feedback on it. If you're interested, you can read a bit more about my take on RDBMS data access for web applications and MQL on the <a href="http://code.google.com/p/mql-to-sql/" >mql-to-sql project home page</a>. I have also put up an <a href="http://mql.qbmetrix.com/mqlread/mql-to-sql-query-editor.php" >online demo</a> that allows you to query the <a href="http://dev.mysql.com/doc/sakila/en/sakila.html" >sakila MySQL sample database</a> using MQL.</dd><br /><dt><a href="http://code.google.com/p/kettle-cookbook/" >kettle-cookbook</a></dt><dd>This is a project that provides auto-documentation for <a href="http://kettle.pentaho.com/" >Kettle</a> (a.k.a. Pentaho Data Integration). <br /><br />The project consists of a bunch of Kettle Jobs and transformations (as well as some XSLT stylesheets) that extract data from Kettle Jobs and transformation and transform it into a collection of human-readable HTML documents along with a table of contents. The resulting documentation looks and feels a bit like JavaDoc documentation. <br /><br />If all goes well, I will be presenting kettle-cookbook in a Pentaho web seminar, which is currently scheduled for September 15, 2010</dd><br /></dl></li><br /><li>I've been enjoying 4 weeks of vacation (I started working this week). There's not much to tell about that, other than that it was great spending a lot of time with my family. I plan to do this more often, and now that Kettle Solutions is finished I should be able to find more time to do it.</li><br /><li>I've been looking at two emerging HTML5 APIs for client-side structured storage, the <a href="http://dev.w3.org/html5/webdatabase/" >Web SQL Database API</a> and the <a href="http://www.w3.org/TR/IndexedDB/" >Indexed DB API</a>. <br /><br />I have developed a few thoughts about the ongoing debate (see <a href="http://hacks.mozilla.org/2010/06/beyond-html5-database-apis-and-the-road-to-indexeddb/" >this</a> and <a href="http://hacks.mozilla.org/2010/06/comparing-indexeddb-and-webdatabase/" ></a> article for some background) about which one is better and I see a role for something like MQL here too. I will probably write something about this in the next few weeks</li><br /><li>Yesterday, I got wind of the <a href="http://js1k.com/home" >JS1k contest</a>! Basically, the challenge is to write an interesting standalone JavaScript demo program that must be no larger than 1024 bytes. It is amazing and inspiring to <a href="http://js1k.com/demos">see what people manage to do</a> with a modern browser in 1k of JavaScript code. <br /><br />I decided to try it myself, and you can find <a href="http://js1k.com/demo/244" >my submission here</a>: An interactive SQL query tool for the Web SQL DB API. <br /><br />Essentially, you get a textarea where you can enter arbitrary SQLite queries, and button to execute the SQL, and a result area that will print a feedback message and a result table (if applicable). As a bonus, there's a button to get a listing of the available database objects (using a query on sqlite_master) and an explain button to show the query plan of the current SQL statement.<br /><br />The demo works on recent versions of Google Chrome, Apple Safari and Opera. It can run offline, and does not require any plugins. I should say that I expect my submission will be rejected by the judges since the demo is not functional on Mozilla Firefox, which is a requirement. (That is, the script will detect that the Web SQL Database API is not supported and print a message to that effect). However, it was still fun to try my hand at it. <br /></li><br /></ul><br />Ok - that's it for now. I will try and post more regularly and write about these and other things in the near future. Don't hesitate to leave a comment if you have any questions or suggestions.<div><img width="1" height="1" src="https://blogger.googleusercontent.com/tracker/15319370-7445810499566340078?l=rpbouman.blogspot.com" alt="" /></div><br/>PlanetMySQL Voting:
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=25531&vote=1&apivote=1">Vote UP</a> /
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=25531&vote=-1&apivote=1">Vote DOWN</a>]]></content:encoded>
			<wfw:commentRss>http://planetmysql.ru/2010/08/11/back-to-blogging/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TOTD #122: Creating a JPA Persistence Unit using NetBeans 6.8</title>
		<link>http://blogs.sun.com/arungupta/entry/totd_122_creating_a_jpa?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=totd-122-creating-a-jpa-persistence-unit-using-netbeans-6-8</link>
		<comments>http://blogs.sun.com/arungupta/entry/totd_122_creating_a_jpa#comments</comments>
		<pubDate>Wed, 10 Feb 2010 07:08:43 +0000</pubDate>
		<dc:creator>Arun Gupta</dc:creator>
				<category><![CDATA[eclipselink]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[javaee]]></category>
		<category><![CDATA[jpa]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[persistenceunit]]></category>
		<category><![CDATA[sakila]]></category>
		<category><![CDATA[totd]]></category>
		<category><![CDATA[v3]]></category>

		<guid isPermaLink="false">http://blogs.sun.com/arungupta/entry/totd_122_creating_a_jpa</guid>
		<description><![CDATA[Taking TOTD #121 forward, this blog explains how to create a JPA Persistence Unit for a MySQL sample database and package it as a library. This JAR file can then be easily included in other web applications.
Lets get started!

    Configure GlassFish for using the MySQL sample database (sakila) as described in TOTD #121.
    Add the GlassFish instance in NetBeans IDE using &#34;Services&#34; panel.
    
Create JPA entities using NetBeans IDE.
        
            Create a Java class library:Our ultimate goal is to create a reusable JAR file and that's why this project type is chosen.
            Specify the name of project as &#34;SakilaPU&#34;:
            Right-click on the project and select &#34;New&#34;, &#34;Entity Classes from Database ...&#34; to initiate the process of entity generation:
            
Choose the database connection as:If not configured, then can be easily done by clicking on &#34;New Database Connection ...&#34; in the list box.
                
                    Click on &#34;Add All &#62;&#62;&#34; to generate the mapped JPA entities for all tables and views.
                    The views do not have primary keys and will need to be appropriately annotated (described later).
                    Click on &#34;Next &#62;&#34;.
                
            
            Give the package name as:and specify the package name as &#34;sakila&#34;. Click on &#34;Create Persistence Unit ...&#34;.
            Change the default PU name from &#34;SakilaPUPU&#34; to &#34;SakilaPU&#34;:and click on &#34;Finish&#34;. Notice that &#34;EclipseLink&#34;, the Reference Implementation of JPA 2.0, is used as the persistence library.
            
Add &#34;@javax.persistence.Id&#34; annotation to the following class/field combination:
                
                    
                        Class
                        Field
                    
                    
                        sakila.SalesByFilmCategory
                        category
                    
                    
                        sakila.ActorInfo
                        actorId
                    
                    
                        sakila.FilmList
                        fid
                    
                    
                        sakila.CustomerList
                        id
                    
                    
                        sakila.NicerButSlowerFilmList
                        fid
                    
                    
                        sakila.StaffList
                        id
                    
                    
                        sakila.SalesByStore
                        store
                    
                
This is required because none of the &#34;views&#34; are defined with a primary key.            
            
                Right-click on the project and select &#34;Clean &#38; Build&#34;. This generates &#34;dist/SakilaPU.jar&#34; and the structure looks like:
                
            
        
    

This JAR file can now be included in any web application. The pre-built JAR file can also be downloaded here. The key items to note about this pre-built JAR:

    Persistence Unit Name: &#34;SakilaPU&#34;
    All classes are in &#34;sakila.*&#34; package.
    Each class has a pre-defined &#34;&#60;CLASS-NAME&#62;.findAll&#34; named query that returns all elements from the underlying view/table.
    Can be easily added in &#34;WEB-INF/lib&#34; directory of your web application.

Even though this blog uses a MySQL sample database, these steps can be easily followed for any other database such as Oracle or JavaDB.
Technorati: totd javaee glassfish v3 jpa eclipselink persistenceunit mysql sakila netbeans]]></description>
			<content:encoded><![CDATA[<p>Taking <a href="http://blogs.sun.com/arungupta/entry/ttd_121_jdbc_resource_for">TOTD #121</a> forward, this blog explains how to create a JPA Persistence Unit for a MySQL sample database and package it as a library. This JAR file can then be easily included in other web applications.</p>
<p>Lets get started!</p>
<ol>
    <li>Configure <a href="http://glassfish.org">GlassFish</a> for using the MySQL sample database (<a href="http://dev.mysql.com/doc/sakila/en/sakila.html">sakila</a>) as described in <a href="http://blogs.sun.com/arungupta/entry/ttd_121_jdbc_resource_for">TOTD #121</a>.</li>
    <li>Add the GlassFish instance in <a href="http://netbeans.org">NetBeans IDE</a> using &quot;Services&quot; panel.</li>
    <li>
Create JPA entities using NetBeans IDE.
        <ol>
            <li>Create a Java class library:<br /><br /><img border="1" style="margin: 5px" alt="" src="http://blog.arungupta.me/wp-content/uploads/2010/02/totd122-create-java-class-library.png" /><br /><br />Our ultimate goal is to create a reusable JAR file and that's why this project type is chosen.<br /></li>
            <li>Specify the name of project as &quot;SakilaPU&quot;:<br /><br /><img border="1" style="margin: 5px" alt="" src="http://blog.arungupta.me/wp-content/uploads/2010/02/totd122-name-and-location.png" /><br /></li>
            <li>Right-click on the project and select &quot;New&quot;, &quot;Entity Classes from Database ...&quot; to initiate the process of entity generation:<br /><br /><img border="1" style="margin: 5px" alt="" src="http://blog.arungupta.me/wp-content/uploads/2010/02/totd122-entity-classes-from-database.png" /></li>
            <li>
Choose the database connection as:<br /><br /><img border="1" style="margin: 5px" alt="" src="http://blog.arungupta.me/wp-content/uploads/2010/02/totd122-db-connection.png" /><br /><br />If not configured, then can be easily done by clicking on &quot;New Database Connection ...&quot; in the list box.
                <ol>
                    <li>Click on &quot;Add All &gt;&gt;&quot; to generate the mapped JPA entities for all tables and views.</li>
                    <li>The views do not have primary keys and will need to be appropriately annotated (described later).</li>
                    <li>Click on &quot;Next &gt;&quot;.<br /></li>
                </ol>
            </li>
            <li>Give the package name as:<br /><br /><img border="1" style="margin: 5px" alt="" src="http://blog.arungupta.me/wp-content/uploads/2010/02/totd122-package-name.png" /><br /><br />and specify the package name as &quot;sakila&quot;. Click on &quot;Create Persistence Unit ...&quot;.</li>
            <li>Change the default PU name from &quot;SakilaPUPU&quot; to &quot;SakilaPU&quot;:<br /><br /><img border="1" style="margin: 5px" alt="" src="http://blog.arungupta.me/wp-content/uploads/2010/02/totd122-create-pu.png" /><br /><br />and click on &quot;Finish&quot;. Notice that &quot;EclipseLink&quot;, the Reference Implementation of JPA 2.0, is used as the persistence library.</li>
            <li>
Add &quot;@javax.persistence.Id&quot; annotation to the following class/field combination:
                <table border="0" width="60%">
                    <tr>
                        <th>Class</th>
                        <th>Field</th>
                    </tr>
                    <tr>
                        <td>sakila.SalesByFilmCategory</td>
                        <td>category</td>
                    </tr>
                    <tr>
                        <td>sakila.ActorInfo</td>
                        <td>actorId</td>
                    </tr>
                    <tr>
                        <td>sakila.FilmList</td>
                        <td>fid</td>
                    </tr>
                    <tr>
                        <td>sakila.CustomerList</td>
                        <td>id</td>
                    </tr>
                    <tr>
                        <td>sakila.NicerButSlowerFilmList</td>
                        <td>fid</td>
                    </tr>
                    <tr>
                        <td>sakila.StaffList</td>
                        <td>id</td>
                    </tr>
                    <tr>
                        <td>sakila.SalesByStore</td>
                        <td>store</td>
                    </tr>
                </table>
<br />This is required because none of the &quot;views&quot; are defined with a primary key.            </li>
            <li>
                <p>Right-click on the project and select &quot;Clean &amp; Build&quot;. This generates &quot;dist/SakilaPU.jar&quot; and the structure looks like:</p>
                <p><img height="530" border="1" style="margin: 5px" width="296" alt="" src="http://blog.arungupta.me/wp-content/uploads/2010/02/totd122-jar-structure.png" /></p>
            </li>
        </ol>
    </li>
</ol>
<p><br /><br />This JAR file can now be included in any web application. The pre-built JAR file can also be <a href="http://blogs.sun.com/arungupta/resource/SakilaPU.jar">downloaded here</a>. The key items to note about this pre-built JAR:</p>
<ul>
    <li>Persistence Unit Name: &quot;SakilaPU&quot;</li>
    <li>All classes are in &quot;sakila.*&quot; package.</li>
    <li>Each class has a pre-defined &quot;&lt;CLASS-NAME&gt;.findAll&quot; named query that returns all elements from the underlying view/table.</li>
    <li>Can be easily added in &quot;WEB-INF/lib&quot; directory of your web application.</li>
</ul>
<p>Even though this blog uses a MySQL sample database, these steps can be easily followed for any other database such as Oracle or JavaDB.</p>
<p><small>Technorati: <a href="http://technorati.com/tags/totd">totd</a> <a href="http://technorati.com/tags/javaee">javaee</a> <a href="http://technorati.com/tags/glassfish">glassfish</a> <a href="http://technorati.com/tags/v3">v3</a> <a href="http://technorati.com/tags/jpa">jpa</a> <a href="http://technorati.com/tags/eclipselink">eclipselink</a> <a href="http://technorati.com/tags/persistenceunit">persistenceunit</a> <a href="http://technorati.com/tags/mysql">mysql</a> <a href="http://technorati.com/tags/sakila">sakila</a> <a href="http://technorati.com/tags/netbeans">netbeans</a></small></p><br/>PlanetMySQL Voting:
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=23404&vote=1&apivote=1">Vote UP</a> /
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=23404&vote=-1&apivote=1">Vote DOWN</a>]]></content:encoded>
			<wfw:commentRss>http://planetmysql.ru/2010/02/10/totd-122-creating-a-jpa-persistence-unit-using-netbeans-6-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TOTD #121: JDBC resource for MySQL and Oracle sample database in GlassFish v3</title>
		<link>http://blogs.sun.com/arungupta/entry/ttd_121_jdbc_resource_for?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=totd-121-jdbc-resource-for-mysql-and-oracle-sample-database-in-glassfish-v3</link>
		<comments>http://blogs.sun.com/arungupta/entry/ttd_121_jdbc_resource_for#comments</comments>
		<pubDate>Tue, 09 Feb 2010 07:00:17 +0000</pubDate>
		<dc:creator>Arun Gupta</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[glassfish]]></category>
		<category><![CDATA[javaee]]></category>
		<category><![CDATA[jpa]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[oracle]]></category>
		<category><![CDATA[sakila]]></category>
		<category><![CDATA[totd]]></category>
		<category><![CDATA[v3]]></category>

		<guid isPermaLink="false">http://blogs.sun.com/arungupta/entry/ttd_121_jdbc_resource_for</guid>
		<description><![CDATA[This blog clearly explains how to configure the MySQL sample database (sakila) with GlassFish. Even though the instructions use a specific database but should work for other databases (such as Oracle, JavaDB, PostgreSQL, and others) as well. The second half of the blog provide specific syntax for the Oracle sample database.

    Download sakila sample database and unzip the archive.
    Install the database as described here - basically load and run &#34;sakila-schema.sql&#34; and &#34;sakila-data.sql&#34; extracted from the archive.
    
Create a new MySQL user account using MySQL CLI Admin and assign the privileges
        
            
Using &#34;root&#34; user (sudo mysql --user root)
                
CREATE USER glassfish IDENTIFIED BY 'glassfish';
GRANT ALL PRIVILEGES ON *.* TO 'glassfish'@'localhost' IDENTIFIED BY 'glassfish';
FLUSH PRIVILEGES;

            
            
Using &#34;glassfish&#34; user (sudo mysql --user glassfish)
                
source sakila-schema.sql;
source sakila-data.sql;

            
        
    
    Download Connector/J, unzip and copy &#34;mysql-connector-java-5.x.x-bin.jar&#34; to &#34;glassfish/domains/domain1/lib/ext&#34; directory.
    
Start GlassFish server as:
        
asadmin start-domain


    
    
Create a JDBC resource
        
            
Create JDBC connection pool as:
                
asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource --restype javax.sql.DataSource --property "User=glassfish:Password=glassfish:URL=jdbc\:mysql\://localhost/sakila" jdbc/sakilaPool

            
            
Test the JDBC connection pool as:
                
asadmin ping-connection-pool jdbc/sakilaPool

            
            
Create the JDBC resource as:
                
asadmin create-jdbc-resource --connectionpoolid jdbc/sakilaPool jdbc/sakila

            
        
    

That's it!
Creating a JDBC resource for any other database requires the following updates to the steps mentioned above. Lets consider modifying these steps for the Oracle sample database.

    
Use the client interface SQL*PLus and connect as:         
sqlplus "/ as sysdba"

create user and grant the privileges as:
        
CREATE USER glassfish IDENTIFIED BY glassfish DEFAULT tablespace users TEMPORARY tablespace temp;
GRANT CONNECT TO glassfish IDENTIFIED BY glassfish;
GRANT UNLIMITED TABLESPACE TO glassfish;
GRANT CREATE TABLE TO glassfish;
GRANT CREATE SEQUENCE TO glassfish;

    
    Copy the appropriate JDBC driver (ojdbc6.jar).
    
Create the JDBC resource as:
        
asadmin create-jdbc-connection-pool --datasourceclassname oracle.jdbc.pool.OracleDataSource --restype javax.sql.DataSource --property "User=hr:Password=hr:URL=jdbc\:oracle\:thin\:@localhost\:1521\:orcl" jdbc/hr
asadmin ping-connection-pool jdbc/hr
asadmin create-jdbc-resource --connectionpoolid jdbc/hr jdbc/hr

as explained in TOTD #108.    

Here are a few other related entries:

    
        RESTful representation of sakila using NetBeans and GlassFish
    
    
        JPA + Servlet 3.0 Application using Sakila in Eclipse
    
    
        JSF + JPA + EJB Application using Oracle, NetBeans, and GlassFish
    

Technorati: totd javaee glassfish v3 jpa mysql sakila oracle]]></description>
			<content:encoded><![CDATA[<p>This blog clearly explains how to configure the MySQL sample database (<a href="http://dev.mysql.com/doc/sakila/en/sakila.html">sakila</a>) with <a href="http://glassfish.org">GlassFish</a>. Even though the instructions use a specific database but should work for other databases (such as Oracle, JavaDB, PostgreSQL, and others) as well. The second half of the blog provide specific syntax for the Oracle sample database.</p>
<ol>
    <li>Download <a href="http://downloads.mysql.com/docs/sakila-db.zip">sakila sample database</a> and unzip the archive.</li>
    <li>Install the database as described <a href="http://dev.mysql.com/doc/sakila/en/sakila.html#sakila-installation">here</a> - basically load and run &quot;sakila-schema.sql&quot; and &quot;sakila-data.sql&quot; extracted from the archive.</li>
    <li>
Create a new MySQL user account using MySQL CLI Admin and assign the privileges
        <ol>
            <li>
Using &quot;root&quot; user (sudo mysql --user root)<br />
                <pre>
CREATE USER glassfish IDENTIFIED BY 'glassfish';
GRANT ALL PRIVILEGES ON *.* TO 'glassfish'@'localhost' IDENTIFIED BY 'glassfish';
FLUSH PRIVILEGES;
</pre>
            </li>
            <li>
Using &quot;glassfish&quot; user (sudo mysql --user glassfish)
                <pre>
source sakila-schema.sql;
source sakila-data.sql;
</pre>
            </li>
        </ol>
    </li>
    <li>Download <a href="http://dev.mysql.com/downloads/connector/j/">Connector/J</a>, unzip and copy &quot;mysql-connector-java-5.x.x-bin.jar&quot; to &quot;glassfish/domains/domain1/lib/ext&quot; directory.</li>
    <li>
Start GlassFish server as:
        <pre>
asadmin start-domain

</pre>
    </li>
    <li>
Create a JDBC resource
        <ol>
            <li>
Create JDBC connection pool as:
                <pre>
asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource --restype javax.sql.DataSource --property "User=glassfish:Password=glassfish:URL=jdbc\:mysql\://localhost/sakila" jdbc/sakilaPool
</pre>
            </li>
            <li>
Test the JDBC connection pool as:
                <pre>
asadmin ping-connection-pool jdbc/sakilaPool
</pre>
            </li>
            <li>
Create the JDBC resource as:
                <pre>
asadmin create-jdbc-resource --connectionpoolid jdbc/sakilaPool jdbc/sakila
</pre>
            </li>
        </ol>
    </li>
</ol>
<p>That's it!</p>
<p>Creating a JDBC resource for any other database requires the following updates to the steps mentioned above. Lets consider modifying these steps for the Oracle sample database.</p>
<ol>
    <li>
Use the client interface SQL*PLus and connect as:<br />         <pre>
sqlplus "/ as sysdba"
</pre>
<br />create user and grant the privileges as:<br />
        <pre>
CREATE USER glassfish IDENTIFIED BY glassfish DEFAULT tablespace users TEMPORARY tablespace temp;
GRANT CONNECT TO glassfish IDENTIFIED BY glassfish;
GRANT UNLIMITED TABLESPACE TO glassfish;
GRANT CREATE TABLE TO glassfish;
GRANT CREATE SEQUENCE TO glassfish;
</pre>
    </li>
    <li>Copy the appropriate JDBC driver (<a href="http://download.oracle.com/otn/utilities_drivers/jdbc/112/ojdbc6.jar">ojdbc6.jar</a>).</li>
    <li>
Create the JDBC resource as:<br />
        <pre>
asadmin create-jdbc-connection-pool --datasourceclassname oracle.jdbc.pool.OracleDataSource --restype javax.sql.DataSource --property "User=hr:Password=hr:URL=jdbc\:oracle\:thin\:@localhost\:1521\:orcl" jdbc/hr
asadmin ping-connection-pool jdbc/hr
asadmin create-jdbc-resource --connectionpoolid jdbc/hr jdbc/hr
</pre>
<br />as explained in <a href="http://blogs.sun.com/arungupta/entry/totd_108_java_ee_6">TOTD #108</a>.    </li>
</ol>
<p>Here are a few other related entries:</p>
<ul>
    <li>
        <p><a href="http://blogs.sun.com/arungupta/entry/restful_representation_of_sakila_using">RESTful representation of sakila using NetBeans and GlassFish</a></p>
    </li>
    <li>
        <p><a href="http://blogs.sun.com/arungupta/entry/totd_99_creating_a_java">JPA + Servlet 3.0 Application using Sakila in Eclipse</a></p>
    </li>
    <li>
        <p><a href="http://blogs.sun.com/arungupta/entry/totd_108_java_ee_6">JSF + JPA + EJB Application using Oracle, NetBeans, and GlassFish</a></p>
    </li>
</ul>
<p><small>Technorati: <a href="http://technorati.com/tags/totd">totd</a> <a href="http://technorati.com/tags/javaee">javaee</a> <a href="http://technorati.com/tags/glassfish">glassfish</a> <a href="http://technorati.com/tags/v3">v3</a> <a href="http://technorati.com/tags/jpa">jpa</a> <a href="http://technorati.com/tags/mysql">mysql</a> <a href="http://technorati.com/tags/sakila">sakila</a> <a href="http://technorati.com/tags/oracle">oracle</a></small></p><br/>PlanetMySQL Voting:
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=23392&vote=1&apivote=1">Vote UP</a> /
	 <a href="http://planet.mysql.com/entry/vote/?entry_id=23392&vote=-1&apivote=1">Vote DOWN</a>]]></content:encoded>
			<wfw:commentRss>http://planetmysql.ru/2010/02/09/totd-121-jdbc-resource-for-mysql-and-oracle-sample-database-in-glassfish-v3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

