A: 

I don't use Toplink so I didn't test this but, my understanding of various resources found over the net is that you'll need to provide an implementation of SessionCustomizer. In this implementation, use the JNDIConnector class to give a DataSource object (c3p0 implements the DataSource API) using the setDataSource(javax.sql.DataSource) method.

Adapt the sample from Working with a non JTA DataSource in Toplink Essentials.

Pascal Thivent
I really don't understand what to do. So blurry page for a beginner.Nevertheless, I created a SessionCustomizer class apart. Here is my customize() method: public void customize(Session session) throws Exception{ DataSource ds = DataSources.unpooledDataSource("myServerURL", "login", "pwd"); DataSource pooled = DataSources.pooledDataSource(ds); JNDIConnector conn = (JNDIConnector)session.getLogin().getConnector(); conn.setDataSource(pooled); conn.setLookupType(JNDIConnector.STRING_LOOKUP); }
Jean N.T.
@Jean Well, the problem is that I'm not using Toplink, that it is incredibly hard to find resources or even pointer to the documentation and, most important part, that I'm not even sure of what you're using exactly (is it Toplink Essentials?). Can you first confirm this?
Pascal Thivent
A: 

I really don't understand what to do. So blurry page for a beginner. Nevertheless, I have created a SessionCustomizer class apart. Here is my customize() method, using c3p0:

public void customize(Session session) throws Exception{ 
DataSource ds = DataSources.unpooledDataSource("myServerURL", "login", "pwd"); 
DataSource pooled = DataSources.pooledDataSource(ds); 
JNDIConnector conn = (JNDIConnector)session.getLogin().getConnector(); 
conn.setDataSource(pooled); 
conn.setLookupType(JNDIConnector.STRING_LOOKUP); 
}

I don't even think it's correct. I'm putting my connection infos in clear in code, really weird.

Secondly, in persistence.xml example from the link, they have put:

<non-jta-data-source>java:comp/env/jdbc/DefaultDS</non-jta-data-source>
   <class>sample.MyEntity</class>
   <properties>
     <property name="toplink.session.customizer" value="es.claro.commons.ds.DataSourceSessionCustomizer"/>
   </properties>

What should I put in mine, particularly for "non-jta-data-source" tag? Is there a way to put connection informations in that xml instead of in code?

Help.

Jean N.T.