Expand my Community achievements bar.

Configuring a connection to MySQL

Avatar

Level 1

I have installed lcds es trial version 2.6.1 with tomcat option. When I run the test of the installation it works OK.

Now I want to make a connection to a MySQL database to access it through a flex program with data service.  The first thing I'm doing is preparing a folder where define the connection.  I copied the c:\lcds\tomcat\webapps\lcds in C:\lcds\tomcat\webapps\foed, assuming that with this there shouldn't be a problen.  Then, when I run lcds with tomcat appears errors.  When I follow creating the options in the data-management-config.xml its turns worst.

I'm looking for a way to connect lcds to MySQL but I can't find it.  I need help configuring the access to MySQL.

Thanks.

Rodolfo.

5 Replies

Avatar

Level 1

anyone can help ? i have the same problem

Avatar

Level 1

Hi,

you can not access the MySQL database directly with flex (like php).

You need to access it via a Java Assember (Custom, SQL, Hibernate, Fiber Assembler) that transfers the data via AMF  ( with BlazeDS/LCDS) to Flex.

So how do you want to access the data, with BlazeDS, with LCDS

and which assembler do you want to use: SQL Assember,  Hibernate Assember, Fiber Assembler ...?

Martin Zach

Avatar

Level 1

Hi, i'd like to use Hibernate Assember  and Fiber. And now my LCDS's connected to

MySQL, but i don't know how to use Hibernate Assember, can u help me. Sory

for my Bad English, i come from VietNamese.

Avatar

Level 1

Hi,

there is a nice example of hibernate in the lcds-examples. They are created with the setup with tomact.

There are several tutorials, google for "Hibernate Flex", for example:

http://fleksray.org/flex_datamanagement_service_hibernate_en.html

The hibernate.cfg.xml for MySQL ist attached below.

Fiber is only part of the new lcds3b1 and Flashbuilder 4b1:

There are nice tutorials under

http://labs.adobe.com/technologies/livecycle_dataservices3/videos/

If you look for very simple connection to mysql you can take a look at

http://www.themidnightcoders.com/products/weborb-for-php

All the best!

Martin Zach

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
        "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
    <session-factory>

        <!-- Database connection settings -->
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="connection.url">jdbc:mysql://localhost:3306/databasename</property>
        <property name="connection.username">user</property>
        <property name="connection.password">password</property>

        <!-- JDBC connection pool (use the built-in) -->
        <property name="connection.pool_size">2</property>

        <!-- SQL dialect -->
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>

        <!-- Enable Hibernate's automatic session context management -->
        <property name="current_session_context_class">thread</property>

        <!-- Disable the second-level cache  -->
        <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>  
       
        <!-- Echo all executed SQL to stdout -->
        <property name="show_sql">true</property>

        <!-- XML Mapping Load the database table mapping file -->
      <mapping resource="flex/samples/contact/Contact.hbm.xml"/>
<!---->
<!--        <mapping resource="flex/samples/person/Person.hbm.xml"/>-->

        <!-- Annotations Mapping-->
<!--        <mapping class="flex.samples.contactannotate.Contact"/>-->


    </session-factory>

</hibernate-configuration

Avatar

Level 1

I Think if using LCDS 3 , Fiber is no1. Because it's easy , visualization and commercial .Now, i'm trying to intergrate BlazeDS + Spring + Hibernate + MySQL (100% OpenSource). I have already configured BlazeDS 3.2 + Spring 3.M3 + MySQL and i don't know how to config Hibernate to work with them. Can u help me?