CDO – Connected Data Objects

An introduction to CDO

This framework, which is a component of the EMF project, allows the sharing of an EMF model.
Whereas with Teneo we can make each client access a database (implementing a two-tier client/server solution), with CDO we make each client access a server which shares them the same model instance.
In this tutorial we will see how to:

  • install CDO
  • create a CDO server
  • create a CDO client

You can find a detailed documentation about CDO at the following link http://www.eclipse.org/cdo/documentation/
While you can download the various versions here  http://www.eclipse.org/cdo/downloads/

 

Installing CDO

Let’s see now how to install CDO starting from version Eclipse 4.2 (Juno) Modeling. CDO can use several Store implementations; here we will prepare to use the DBStore.

Furthermore, since we will use a MySQL database, we have to make sure that the correspondent JDBC plug-in is installed (please note that if you followed the tutorial Teneo Setup for Eclipse 4.2 – Juno you can skip this step)

Update Site => http://www.elver.org/eclipse/2.0.0/update/

  • MySQL Connector/J

Now let’s install  Net4j DB Adapter for MySQL
Update Site =>
http://download.eclipse.org/modeling/emf/cdo/updates/releases

Let’s expland the more recent category and select the following:

CDO R<latest>
> Net4j DB Framework
>> Net4j DB Framework MYSQL Adapter

 

Creating a CDO server

In this section we will see how to create a feature-based Eclipse product that will handle the launch of a CDO server defined by an XML configuration file.
In Eclipse a feature is a set of plug-ins which collaborate in order to provide a software functionality.
So let’s create a Feature Project with   File -> New -> Project… -> Plug-in Development -> Feature Project

press Next and at the next step give a name to our project, for example it.rcpvision.rcptutorial.cdo.server

then Finish.

What we just obtained is an empty feature; let’s go to tab Plug-ins and add the following plug-ins using button  Add…

 

Note: if you don’t want to add them one by one, here is the content of file feature.xml, which you can modify with tab “feature.xml

<?xml version="1.0" encoding="UTF-8"?>
<feature
      id="it.rcpvision.rcptutorial.cdo.server"
      label="Server"
      version="1.0.0.qualifier">

   <description url="http://www.example.com/description">
      [Enter Feature Description here.]
   </description>

   <copyright url="http://www.example.com/copyright">
      [Enter Copyright Description here.]
   </copyright>

   <license url="http://www.example.com/license">
      [Enter License Description here.]
   </license>

<plugin id="com.mysql.jdbc" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.core.contenttype" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.core.jobs" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.core.runtime" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.core.runtime.compatibility.registry" download-size="0" install-size="0" version="0.0.0" fragment="true"/>
<plugin id="org.eclipse.emf.cdo" download-size="0" install-size="0" version="0.0.0" unpack="false"/> 
<plugin id="org.eclipse.emf.cdo.common" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.emf.cdo.server" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.emf.cdo.server.db" download-size="0" install-size="0" version="0.0.0" unpack="false"/> 
<plugin id="org.eclipse.emf.cdo.server.net4j" download-size="0" install-size="0" version="0.0.0" unpack="false"/> 
<plugin id="org.eclipse.emf.common" download-size="0" install-size="0" version="0.0.0" unpack="false"/> 
<plugin id="org.eclipse.emf.ecore" download-size="0" install-size="0" version="0.0.0" unpack="false"/> 
<plugin id="org.eclipse.emf.ecore.change" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.emf.ecore.xmi" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.equinox.app" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.equinox.common" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.equinox.preferences" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.equinox.registry" download-size="0" install-size="0" version="0.0.0" unpack="false"/> 
<plugin id="org.eclipse.net4j" download-size="0" install-size="0" version="0.0.0" unpack="false"/> 
<plugin id="org.eclipse.net4j.db" download-size="0" install-size="0" version="0.0.0" unpack="false"/> 
<plugin id="org.eclipse.net4j.db.mysql" download-size="0" install-size="0" version="0.0.0" unpack="false"/> 
<plugin id="org.eclipse.net4j.tcp" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.net4j.util" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.osgi" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.net4j.db.h2" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.h2" download-size="0" install-size="0" version="0.0.0" unpack="false"/>
<plugin id="org.eclipse.emf.cdo.server.product" download-size="0" install-size="0" version="0.0.0" unpack="false"/>

</feature>

Now let’s create a product based on this feature; just right-click on this project and select New -> Other… -> Plug-in Development -> Product Configuration

press Next.
At the next step give a name to our product, for instance  CDO-Server.product,

 

select “Use an existing product” radio-button and in the combo next to the selected radio-button set the value “org.eclipse.emf.cdo.server.product.tcp_h2“, then Finish.
What we just obtained is a product, but it is now plug-ins based.

 

in order to have it feature-based we need to select the correspondent radio-button

 

now, to list the features that make part of that product, select tab Dependencies

press button Add…

and select the just created feature (it.rcpvision.rcptutorial.cdo.server)

and save the product (Ctrl-S).

Now it’s time to define the XML configuration file for CDO. Let’s select the project and create a folder named “rootfiles” (right click, New -> Folder)
and then add another subfolder named “configuration

inside this folder let’s create a file (right click, New -> File) named cdo-server.xml and copy the following content inside

<?xml version="1.0" encoding="UTF-8"?>
<cdoServer>

	<acceptor type="tcp" listenAddr="0.0.0.0" port="2036">
	</acceptor>

	<repository name="demo">

		<store type="db">
			<mappingStrategy type="horizontal"/>
			<dbAdapter name="mysql"/>
			<dataSource 
				class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" 
				url="jdbc:mysql://localhost/cdotest?createDatabaseIfNotExist=true"
				user="root"
				password="admin"
				/>
		</store>
	</repository>

</cdoServer>

This configuration file indicates that a CDO server will be active on TCP port 2036 and it will make available a CDO repository named “demo“. Just after we find the database coordinates.
Please note that at first startup or after a model change, it is advisable to drop the database; it will be created automatically at startup.
Before launching the server we need yet to pass the location of the configuration file .
In order to do so just select the product, go to Launching tab and in the VM Arguments section provide the following parameter value

-Dnet4j.config=${resource_loc:/it.rcpvision.rcptutorial.cdo.server/rootfiles/configuration}

save the product, get back to Overview tab and launch, with
Launch An Eclipse Application

The console should end with a message like this

!MESSAGE CDO server started

Verify that the database is successfully created.

Well, now at the network address of this computer, at the configured Net4j port (2036), the CDO repository named “demo” is available.

Just one note: in order to be prepared when we will need to deploy the product, it is advisable to make the product include also the configuration file (otherwise it would not be exported). To do this let’s open the build.properties file, go to Build tab and in the “Binary Build” section just select the folder “rootfiles“.

<?xml version=”1.0″ encoding=”UTF-8″?>
<cdoServer> 

<acceptor type=”tcp” listenAddr=”0.0.0.0″ port=”2036″>
</acceptor>

<repository name=”demo”>
<property name=”overrideUUID” value=”1ff5d226-b1f0-40fb-aba2-0c31b38c764f”/>
<property name=”supportingAudits” value=”true”/>

<store type=”db”>
<mappingStrategy type=”horizontal”>
<property name=”qualifiedNames” value=”false”/>
<property name=”toManyReferences” value=”ONE_TABLE_PER_REFERENCE”/>
<property name=”toOneReferences” value=”LIKE_ATTRIBUTES”/>
</mappingStrategy>

<dbAdapter name=”mysql”/>
<dataSource class=”com.mysql.jdbc.jdbc2.optional.MysqlDataSource”
url=”jdbc:mysql://localhost/cdotest?createDatabaseIfNotExist=true”
user=”root”
password=”admin”
/>
</store>
</repository>

</cdoServer>

 

 

 

Creating a CDO client

Here we will use the same EMF model (the plug-in it.rcpvision.rcptutorial.model) used in previous tutorials (see ). In case you are going to do that tutorial again, consider that now, when creating the EMF Generator Model (.genmodel), at step “Select a Model Importer” you should select “Ecore model (CDO Native)“.
Otherwise, if you have the previous model plugin available (which was created without the CDO compatibility option) you can convert it by right-clicking file .genmodel and clicking on CDO -> Migrate EMF Generator Model (dynamic feature delegation)

 

and obviously re-generating model sources

further, in plug-in it.rcpvision.rcptutorial.model, we need to add a dependence on CDO

In the end we are ready to really create our client. Create an RCP application the usual way (see How to create an RCP application) and add the following dependences:

  • it.rcpvision.rcptutorial.model
  • org.eclipse.emf.cdo
  • org.eclipse.emf.cdo.net4j
  • org.eclipse.net4j.tcp
  • org.eclipse.emf.ecore.change
  • org.junit4

Let’s create now a class named “TestCdoClient” in the main package, with the following content

package it.rcpvision.rcptutorial.application;

import library.Author;
import library.Book;
import library.Library;
import library.LibraryFactory;

import org.eclipse.emf.cdo.eresource.CDOResource;
import org.eclipse.emf.cdo.net4j.CDONet4jUtil;
import org.eclipse.emf.cdo.net4j.CDOSession;
import org.eclipse.emf.cdo.net4j.CDOSessionConfiguration;
import org.eclipse.emf.cdo.transaction.CDOTransaction;
import org.eclipse.emf.cdo.util.CommitException;
import org.eclipse.net4j.Net4jUtil;
import org.eclipse.net4j.connector.IConnector;
import org.eclipse.net4j.tcp.TCPUtil;
import org.eclipse.net4j.util.container.IPluginContainer;
import org.eclipse.net4j.util.lifecycle.ILifecycle;
import org.eclipse.net4j.util.lifecycle.LifecycleEventAdapter;
import org.junit.BeforeClass;
import org.junit.Test;

public class TestCdoClient {

    private static CDOSession cdoSession;

    @BeforeClass
    public static void init() {
    	//The following lines are not needed if the extension 
    	//registry (OSGi/Equinox) is running
        Net4jUtil.prepareContainer(IPluginContainer.INSTANCE);
        TCPUtil.prepareContainer(IPluginContainer.INSTANCE);

        cdoSession = openSession("demo");
    }

    @Test
    public void popola() {
    	try {
            CDOTransaction transaction = cdoSession.openTransaction();
            CDOResource resource = transaction.getOrCreateResource("/myResource");
            Library library = LibraryFactory.eINSTANCE.createLibrary();

            Book book = LibraryFactory.eINSTANCE.createBook();
            book.setTitle("Eclipse Modeling Framework (2nd edition)");
            library.getListBook().add(book);

            Author author = LibraryFactory.eINSTANCE.createAuthor();
            author.setName("Ed");
            author.setSurname("Merks");
            library.getListAuthor().add(author);
            book.getAuthor().add(author);

            author = LibraryFactory.eINSTANCE.createAuthor();
            author.setName("Marcelo");
            author.setSurname("Paternostro");
            library.getListAuthor().add(author);
            book.getAuthor().add(author);

            author = LibraryFactory.eINSTANCE.createAuthor();
            author.setName("Frank");
            author.setSurname("Budinsky");
            library.getListAuthor().add(author);
            book.getAuthor().add(author);

            author = LibraryFactory.eINSTANCE.createAuthor();
            author.setName("David");
            author.setSurname("Steinberg");
            library.getListAuthor().add(author);
            book.getAuthor().add(author);

            resource.getContents().add(library);
            transaction.commit();
            cdoSession.close();

    	} catch (CommitException e) {
			e.printStackTrace();
		} finally {
    		cdoSession.close();
    	}
    }

    public static CDOSession openSession(String repoName) {
        final IConnector connector = (IConnector) IPluginContainer.INSTANCE
                .getElement( //
                        "org.eclipse.net4j.connectors", // Product group
                        "tcp", // Type
                        "localhost"); // Description

        CDOSessionConfiguration config = CDONet4jUtil
                .createSessionConfiguration();
        config.setConnector(connector);
        config.setRepositoryName(repoName);

        CDOSession session = config.openSession();

        session.addListener(new LifecycleEventAdapter() {
            @Override
            protected void onDeactivated(ILifecycle lifecycle) {
                connector.close();
            }
        });

        return session;
    }

}

As you can see it is a JUnit test that connects to the “demo” CDO repository which is available at address “localhost” (should the client be executed on a different computer you should obviously change this address with the one from the CDO server). Then some model instance are created and persisted inside a CDO transaction.

Let’s launch it with right-click  Run As -> JUnit Test

If all run successfully you should see an ok outcome on JUnit View


and you should see the inserterd data on the database.

Please note that we created an RCP application and then created and used a simple (stand-alone) JUnit class to access CDO. This was made for the following reasons:

  • to obtain quickly a CDO client (we just needed to add some Dependencies)
  • to demonstrate how easily is accessing to a CDO server (no need of OSGi/Equinox at runtime)

Moreover, in the next tutorials we will often start with an RCP application that access to a CDO server repository.

 

Back to index

 

This entry was tagged , , , , , , , , , . Bookmark the permalink.

25 Responses to CDO – Connected Data Objects

  1. umashankarsubramani says:

    When I run the server as “Eclipse Application” from the overview tab, I got the following error. Could you please help me?

    java.lang.NoClassDefFoundError: Workspace\it/rcpvision/rcptutorial/cdo/server\rootfiles\configuration
    Caused by: java.lang.ClassNotFoundException: Workspace\it.rcpvision.rcptutorial.cdo.server\rootfiles\configuration
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    Exception in thread “main”

  2. umashankarsubramani says:

    The server configuration given here, does not work. Rather, I used the one given here: http://wiki.eclipse.org/Getting_started_with_CDO_Helios

    Is it okay, to use this server configuration?

  3. Giancarlo says:

    Ciao Vincenzo,

    innanzitutto complimenti per le guide.

    Ho un problema che non riesco a risolvere. Ho fatto tutti gli step, dall’app RCP alla creazione del server CDO.
    Però non riesco a far dialogare il server con il mio datasource. Non ho usato MySql perchè ho SQLServer, che devo dire, con gli altri esercizi funziona.
    Come posso ovviare al problema ?
    Ovviamente ho inserito nelle features quella della connessione a sqlserver. (com.microsoft.sqlserver.jdbc)
    Ti posto il datasource:
    ______________________________________________________________

    ___________________________________________________________
    Dove sbaglio ? L’errore della console è :

    ENTRY org.eclipse.emf.cdo.server 1 0 2012-02-07 11:31:10.953
    !MESSAGE CDO server starting
    [ERROR] Unknown DB adapter: sqlserver
    java.lang.IllegalArgumentException: Unknown DB adapter: sqlserver
    at org.eclipse.emf.cdo.server.internal.db.DBStoreFactory.getDBAdapter(DBStoreFactory.java:105)
    at org.eclipse.emf.cdo.server.internal.db.DBStoreFactory.createStore(DBStoreFactory.java:52)
    at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.createStore(RepositoryConfigurator.java:291)
    at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.getRepository(RepositoryConfigurator.java:163)
    at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.configure(RepositoryConfigurator.java:105)
    at org.eclipse.emf.cdo.internal.server.bundle.CDOServerApplication.doStart(CDOServerApplication.java:61)
    at org.eclipse.net4j.util.om.OSGiApplication.start(OSGiApplication.java:61)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.equinox.internal.app.AnyThreadAppLauncher.run(AnyThreadAppLauncher.java:26)
    at java.lang.Thread.run(Unknown Source)

    Grazie ciao….

    • Vincenzo says:

      Ciao Giancarlo,
      quando si cambia tipo di database la feature del driver JDBC (es. com.microsoft.sqlserver.jdbc) non è sufficiente.
      Occorre anche la feature dell’Adapter per Net4J (l’errore infatti dice “Unknown DB adapter: sqlserver”).
      Come puoi vedere nella figura in alto (sotto la dicitura “Net4j DB Framework MYSQL Adapter”) non è presente un Adapter per MsSQL al momento. Quindi se scegli CDO hai due strade: o scegli un tipo di database diverso (tra Derby, H2, HSQLDB, MYSQL, PostgreSQL) oppure implementi un Adapter per il database specifico.
      Se scegli invece Teneo (=il client accede direttamente al database, a differenza di CDO dove il client accede ad un server CDO il quale poi accede al db) allora potrai usare MsSQL (Teneo usa Hibernate, quindi basta cambiare il dialect).

  4. Giancarlo says:

    Ecco il datasource

    ..cdoServer…
    ..acceptor type=”tcp” listenAddr=”0.0.0.0″ port=”2036″…
    …acceptor…
    …repository name=”demo”…
    ..store type=”db”…
    …mappingStrategy type=”horizontal”/…
    …dbAdapter name=”sqlserver”/…
    …dataSource
    class=”com.microsoft.sqlserver.jdbc.SQLServerDriver”
    url=”jdbc:sqlserver://localhost:1433;DatabaseName=CDOSERVER”
    user=”++++”
    password=”——-”
    /…
    …/store…
    …/repository…
    ../cdoServer…

  5. Mark Rowe says:

    Vincenzo, thanks for a really great tutorial. I wish I had read this earlier, will now continue with your series :-)

  6. Julia says:

    Hello,
    I’m trying to run the Client, but I got following error message:
    Exception in thread “main” org.eclipse.net4j.util.container.FactoryNotFoundException: Factory not found: org.eclipse.net4j.connectors[tcp]
    caused by:
    IConnector connector = (IConnector)container.getElement(“org.eclipse.net4j.connectors”, “tcp”, “localhost:2036″);
    I ‘m using Eclipse Indigo 3.7.2 and CDO 4.0
    Can you help me?

  7. Stefano says:

    io non ho questa opzione “org.eclipse.emf.cdo.server.product.tcp_h2“ come mai?

  8. Modeji says:

    Hello, I am trying to connect eclipse rcp 4 to a backend database (MySQL) using hibernate. I tried to follow your tutorial to do just that, however, am getting this error:

    SEVERE: Could not find EPackage “http://www.eclipse.org/emf/teneo/hibernate/examples/extlibrary”.
    org.xml.sax.SAXException: Could not find EPackage “http://www.eclipse.org/emf/teneo/hibernate/examples/extlibrary”.
    at org.eclipse.emf.teneo.annotations.xml.XmlPersistenceContentHandler.startElement(XmlPersistenceContentHandler.java:311)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:506)
    at org.eclipse.emf.teneo.hibernate.HbSessionDataStore.initialize(HbSessionDataStore.java:112)
    at org.eclipse.emf.teneo.hibernate.examples.samples.Tutorial.main(Tutorial.java:97)

    I then commented out the following line:
    hibernateProperties.setProperty(PersistenceOptions.PERSISTENCE_XML, “org/eclipse/emf/teneo/hibernate/examples/annotations.xml”);

    I am now getting this error:

    Exception in thread “main” org.hibernate.QueryException: could not resolve property: name of: Writer [SELECT book FROM Book book, Writer writ WHERE book.title='1984' AND book.author=writ AND writ.name='G. Orwell']
    at org.hibernate.persister.entity.AbstractPropertyMapping.propertyException(AbstractPropertyMapping.java:83)
    at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1649)
    at org.eclipse.emf.teneo.hibernate.examples.samples.Tutorial.main(Tutorial.java:193)

    Please could you let me know where is it that am going wrong.
    Thanks

    • Vincenzo says:

      Hi Modeji,
      in CDO there exists several implementation of ‘Stores’, e.g. DBStore, HibernateStore, DB4OStore, MEMStore, ObjectivityStore.
      In this tutorial we use DBStore, which does not uses Hibernate.
      I suppose you are using HibernateStore instead, do you?
      In this case I cannot help unless you provide all sources and xml files content.

      Vincenzo

      • Modeji says:

        Hi Vincezo, thank you for the response.

        That was very informative. I am very new to the CDO project. I was actually trying to do databinding to an Elipse RCP SWT widget with the sample ExtlibraryPackage project. I tried to do so by following the above tutorial and the “WindowBuilder: installing and EMF databinding” tutorial.

        The most important question that I have is that: can I actually use the CDO HibernateStore to perform CRUD in Eclipse RCP without going through or creating the whole .genmodel, .ecore and ecore_diagram stuff? If so is there any example code that I could follow?

        • Vincenzo says:

          Hi Modeji,
          HibernateStore is just another way to let CDO persist data on a RDBMS, so, unless you need it for particular purposes (e.g. want to use a database supported by Hibernate, but not yet supported by DBStore) you barely see differences in a simple application.
          CDO works with an EMF Model, so, yes, you have to go through .ecore (diagram is not necessary, it’s just a different way to handle .ecore) and then .genmodel

  9. Modeji says:

    I am using eclipse 4.2 (Juno) and CDO 4.1

  10. Ivan Alejandro says:

    ciao Vincenzo

    the method named “add” doesnt exist on the class “Author”,
    what should i do ?

    example:

    Author author = LibraryFactory.eINSTANCE.createAuthor();
    author.setName(“Ed”);
    library.getListAuthor().add(author);
    book.getAuthor().add(author); //ERROR

  11. Vincenzo says:

    Ciao Alejandro,
    the article has a reference to the (prerequiste) following tutorial
    http://www.rcp-vision.com/?p=603&lang=en
    At the end of this tutorial the model is changed in order to allow multiple authors for a book.
    Probably you did not followed this last step.
    Alternatively (if you want to keep a single author for a book) you can do just:

    book.setAuthor(author);

    Let me know
    Vincenzo

  12. Ivan Alejandro says:

    ciao vincezo,

    When I run the server as “Eclipse Application” from the overview tab, I got the following error. Could you please help me?

    [INFO] CDO server starting
    !SESSION 2013-05-27 18:48:36.356 ———————————————–
    eclipse.buildId=unknown
    java.version=1.6.0_45
    java.vendor=Sun Microsystems Inc.
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=es_CO
    Framework arguments: -product org.eclipse.emf.cdo.server.product.tcp_h2
    Command-line arguments: -product org.eclipse.emf.cdo.server.product.tcp_h2 -data F:\tesis\eclipse\workspace_rcpvision/../runtime-CDO-server.product -dev file:F:/tesis/eclipse/workspace_rcpvision/.metadata/.plugins/org.eclipse.pde.core/CDO-Server.product/dev.properties -os win32 -ws win32 -arch x86 -consoleLog

    !ENTRY org.eclipse.emf.cdo.server 1 0 2013-05-27 18:48:37.183
    !MESSAGE CDO server starting
    [ERROR] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘OPTION SQL_SELECT_LIMIT=DEFAULT’ at line 1
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘OPTION SQL_SELECT_LIMIT=DEFAULT’ at line 1
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    at com.mysql.jdbc.Util.getInstance(Util.java:381)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1051)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3563)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3495)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2113)
    at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2687)
    at com.mysql.jdbc.ConnectionImpl.unsetMaxRows(ConnectionImpl.java:5571)
    at com.mysql.jdbc.StatementImpl.realClose(StatementImpl.java:2374)
    at com.mysql.jdbc.StatementImpl.close(StatementImpl.java:508)
    at org.eclipse.net4j.db.DBUtil.close(DBUtil.java:222)
    at org.eclipse.net4j.spi.db.DBAdapter.createTables(DBAdapter.java:123)
    at org.eclipse.net4j.spi.db.DBSchema.create(DBSchema.java:118)
    at org.eclipse.emf.cdo.server.internal.db.DBStore.doActivate(DBStore.java:531)
    at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:76)
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:114)
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:104)
    at org.eclipse.emf.cdo.internal.server.Repository.doActivate(Repository.java:1846)
    at org.eclipse.net4j.util.lifecycle.Lifecycle.activate(Lifecycle.java:76)
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:114)
    at org.eclipse.net4j.util.lifecycle.LifecycleUtil.activate(LifecycleUtil.java:104)
    at org.eclipse.emf.cdo.server.CDOServerUtil.addRepository(CDOServerUtil.java:208)
    at org.eclipse.emf.cdo.spi.server.RepositoryConfigurator.configure(RepositoryConfigurator.java:111)
    at org.eclipse.emf.cdo.internal.server.bundle.CDOServerApplication.doStart(CDOServerApplication.java:61)
    at org.eclipse.net4j.util.om.OSGiApplication.start(OSGiApplication.java:63)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.equinox.internal.app.AnyThreadAppLauncher.run(AnyThreadAppLauncher.java:26)
    at java.lang.Thread.run(Thread.java:662)

    [ERROR] Problem with table cdo_lobs: SELECT id, size, bdata, cdata FROM cdo_lobs
    org.eclipse.net4j.db.DBException: Problem with table cdo_lobs: SELECT id, size, bdata, cdata FROM cdo_lobs..

    :’( … another question -> do you speak spanish ?( Español )

    • Vincenzo says:

      Ciao Ivan,
      no, I don’t speak spanish, although, being italian probably I could easily understand most words ;)
      Anyway, I never saw the problem you are reporting.
      Could you please provide the exact versions of the following items?
      - Eclipse Juno SR1 or SR2?
      - Juno Modeling package or other?
      - versions of CDO R…, Net4j DB Framework, Net4j DB Framework MYSQL Adapter
      - version of MySQL
      Thank you
      Vincenzo

      • Ivan Alejandro says:

        vincenzo mira

        - Juno Service Release 2
        - Eclipse Modeling Framework Runtime and Tools Version: 2.8.3.
        - CDO Model Repository Client Version: 4.1.2
        - CDO Model Repository Server Version: 4.1.2
        - Net4j DB Framework Version: 4.1.2
        - Net4j DB Framework MYSQL Adapter Version: 4.1.0
        - MySQL Server 5.6

        Ojalá y pueda ayudarme, gracias!!

        • Darren says:

          The problem is that in MySQL 56 they removed the SET OPTION syntax and replaced it with just SET, so
          SET SQL_SELECT_LIMIT=10;
          works, but:
          SET OPTION SQL_SELECT_LIMIT=10

          It seems that something in CDO/Net4j etc. is making statements that use the old and now defunct syntax, which means that CDO etc. is probably not compatible with MySQL 56 at present (unless there are later versions of the features used in this tutorial).

          See:
          http://stackoverflow.com/questions/13023548/mysql-server-version-for-the-right-syntax-to-use-near-option-sql-select-limit-1

          • Ivan Alejandro says:

            Is it necessary to change my version of MySQL?

          • Vincenzo says:

            Ivan,
            the problem is summarized here https://bugs.eclipse.org/bugs/show_bug.cgi?id=409558.
            For now you can do two things: either install MySQL 5.5 or do the following trick.
            - open view “Plug-ins”, select “com.mysql.jdbc”, right-click “Import as” -> “Source project”
            - go back to “Package Explorer” view
            - remove file “mysql-connector… .jar” and copy here the one you can find in your MySQL 5.6 installation (if you downloaded the Installer version and followed the default wizard you’ll find it in \Program Files\MySQL\Connector J 5.1.24\mysql-connector-java-5.1.24-bin.jar)
            - rename the file into com.mysql.jdbc_5.1.11.201210222237.jar
            or
            - go to MANIFEST.MF, tab Runtime and add the correct jar in the Classpath section and Export all its packages in the Exported Packages section
            then it works!

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>