Yes, you can just use the DataSource entry in the config file by itself.  I'd suggest that you use vanilla IoC and declare an accessor/mutator pair for the DataSource in your ApplicationAdapter subclass.  Then you'll need to declare the DataSource as a property of your ApplicationAdapter in the red5-web.xml like so:

<bean id="web.handler" class="example.Application" singleton="true">
        <property name="dataSource" ref="dataSource" />
</bean>

From there you'd just treat it like any old instance variable.  Keep in mind that you'll loose all transactional support provided by Spring and the JTA, so you'll have to manage any rollbacks yourself.  I'd also suggest that you pick up a book on Spring and familiarize yourself with it.  It's pretty slick.

Carl

On 10/25/06, Tomáš Procházka <[EMAIL PROTECTED]> wrote:
Hi.

Nice example. But too complicated.

I need only DataSource and than I use DBUtils:

        QueryRunner qr = new QueryRunner(DataConn.getDataSource());
        try {
            qr.update("...);
        } catch (SQLException ex) {
            log.fatal("SQL error",ex);
        }

But I can obtain datasource in RED5 application?

Can I use this

        <bean id="dataSource" class=" org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="${jdbc.driverClassName}" />
        <property name="url" value="${ jdbc.url}" />
        <property name="username" value="${jdbc.username}" />
        <property name="password" value="${jdbc.password}" />
    </bean>

from your code? And how I get datasource in app code?

-------------------------- Original message --------------------------
       From: Chris Allen <[EMAIL PROTECTED] >
    Subject: [Red5] Red5+Hibernate
       Date: Tuesday, October 10, 2006, 6:30:15 PM
Attachments: <none>
       msgid:[EMAIL PROTECTED]

C> Carl,

C> I think that Hibernate, Flash and Red5 are a killer combination.
C> Thanks for putting this together and sharing it with the community. I
C> will take a look at it when I get a chance.

C> -Chris

C> On 10/9/06, Carl Sziebert <[EMAIL PROTECTED]> wrote:
>> All:

>> I've written a small test/example app which demonstrates connecting to a
>> MySQL database via Hibernate to do simple authentication of a new client
>> connecting to a Red5 application.  Everything is wired together using Spring
>> and only the necessary JARs are provided in the lib directory.  The app ONLY
>> runs on the latest code from SVN and it's a bit involved to get working, but
>> I thought it was worth sharing with the community.  Paul G. has verified
>> that it works under both Jetty and Tomcat.  See the included readme for
>> (minimal) setup instructions.

>> To use the application as provided, all you will need to do is drop the
>> 'WEB-INF' directory into a Red5 application directory named 'hibernate'.
>> Make sure that you've got MySQL running and configured correctly with the
>> info provided.  After that you can test your install with the simple client
>> I've provided (swf/dist/test.html).

>> http://sziebert.net/software/examples/Red5+Hibernate.zip

>> Carl
>> --
>> Be who you are and say what you feel, because those who mind don't matter
>> and those who matter don't mind.
>>   - Dr. Seuss
>> _______________________________________________
>> Red5 mailing list
>> [email protected]
>> http://osflash.org/mailman/listinfo/red5_osflash.org




C> _______________________________________________
C> Red5 mailing list
C> [email protected]
C> http://osflash.org/mailman/listinfo/red5_osflash.org

----------------------- End of original message ----------------------

--
Tomas Prochazka


_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org



--
Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind.
  - Dr. Seuss
_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to