Jboss, JBuilder and Ms Access
patbier Apr 10, 2003 4:15 AMHello, i work on a J2EE project for my studies.
I use JBoss 3.0.4 / Tomcat 4.1.12, and JBuilder8 for the developpement. I use CMP Beans to read / write in a database. First, i worked with MySql but now i have to use Ms Access.
I need your help, because, i have difficulties in connecting JBoss with Ms Access, whereas it was easy with MySql.
I now describe what i've done and please, tell me where i'm wrong, i need your advice.
- in JBuilder 8, in Tools, DataBase Pilot, i used the driver sun.jdbc.odbc.JdbcOdbcDriver and as the URL jdbc:odbc:BDAccessGPAO
then it found the access database with Windows odbc and i can define EJB CMP Beans from this source
- in JBoss, i copied \docs\examples\jca\msaccess-service.xml in \server\default\deploy
i modified the following lines :
Code:
<config-property name="ConnectionURL" type="java.lang.String">jdbc:odbc:BDAccessGPAO Database</config-property>
<config-property name="DriverClass" type="java.lang.String">sun.jdbc.odbc.JdbcOdbcDriver</config-property>
then, how can i modify this file : \server\default\conf\standardjbosscmp-jdbc.xml ??
Code:
java:/DefaultDS
<datasource-mapping>Hypersonic SQL</datasource-mapping>
i need to modify the database type (mysql, oracle...) but access miss so i don't modify this file
- then , i created EJB CMP. for instance, i created an EJB called "Gammes" for a table "gammes". i wrote a finder : FindAll
Code:
SELECT OBJECT(p) FROM Gammes p
- then , i wrote a javabean "GammesAccessJavaBean", which i quote a part :
Code:
public class GammesAccessJavaBean {
GammesRemoteHome home;
private final static Enumeration EMPTY_ENUMERATION =
new Vector().elements();
public GammesAccessJavaBean() {
try {
InitialContext jndiContext = new InitialContext();
Object ref = jndiContext.lookup("GammesAccessRemote");
home =
(GammesRemoteHome) PortableRemoteObject.narrow(ref,
GammesRemoteHome.class);
}
catch (Exception ie) {
ie.printStackTrace();
}
}
public Collection liste() {
try {
Collection myFound = home.findAll();
return myFound;
}
catch (Exception e) {
e.printStackTrace();
return null;
}
}
so from a jsp, i execute the function "liste" but the operation speds a lot of time and results aren't complete.
Please help me and sorry for my bad english