• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sun's j2ee server and Oracel 8i  RSS feed

 
weiqi, zhang
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I don't have any trouble to use j2ee server and cloudscape to
run J2EE tutorial savingaccounts example. However when I switched to use oracle 8i database, I got headache as below:
java.rmi.ServerException:
RemoteException occurred in server thread;
nested exception is:
java.rmi.RemoteException:
nested exception is:
javax.ejb.EJBException: Unable to connect to database.
Null user or password not supported in THIN driver;
nested exception is:
javax.ejb.EJBException: Unable to connect to database.
Null user or password not supported in THIN driver
at savingsAccountBean.setEntityContext(SavingsAccountBean.java:137)
Here is how I set up the driver and datasource:
I have followed the configuration guide and use j2eeadmin
addJdbcDriver and addJdbcDatasource to add driver, jndi name
and url. The ..\j2sdkee1.3\config\resource.properties showed as:
jdbcDataSource.5.name=jdbc/test/sampledb
jdbcDataSource.5.url=jdbc racle:thin:scott/tiger@localhost:1521:hqtech
jdbcDriver.1.name=oracle.jdbc.driver.OracleDriver
And oracle stuff is located at ..\test\sampledb\.bings and looks like:
#This file is used by the JNDI FSContext.
#Thu Aug 02 14:08:17 EDT 2001
jdbc/test/sampledb/RefAddr/0/Type=userName
jdbc/test/sampledb/RefAddr/1/Content=tiger
jdbc/test/sampledb/ClassName=oracle.jdbc.pool.OracleDataSource
jdbc/test/sampledb/RefAddr/5/Encoding=String
jdbc/test/sampledb/RefAddr/1/Type=passWord
jdbc/test/sampledb/RefAddr/2/Type=driverType
jdbc/test/sampledb/FactoryName=oracle.jdbc.pool.OracleDataSourceFactory
jdbc/test/sampledb/RefAddr/2/Encoding=String
jdbc/test/sampledb/RefAddr/3/Type=serverName
jdbc/test/sampledb/RefAddr/5/Content=tcp
jdbc/test/sampledb/RefAddr/3/Content=localhost
jdbc/test/sampledb/RefAddr/2/Content=thin
jdbc/test/sampledb/RefAddr/4/Type=databaseName
jdbc/test/sampledb/RefAddr/6/Encoding=String
jdbc/test/sampledb/RefAddr/0/Content=scott
jdbc/test/sampledb/RefAddr/0/Encoding=String
jdbc/test/sampledb/RefAddr/5/Type=networkProtocol
jdbc/test/sampledb/RefAddr/4/Encoding=String
jdbc/test/sampledb/RefAddr/6/Type=portNumber
jdbc/test/sampledb/RefAddr/3/Encoding=String
jdbc/test/sampledb/RefAddr/6/Content=1521
jdbc/test/sampledb/RefAddr/4/Content=hqtech
jdbc/test/sampledb/RefAddr/1/Encoding=String
I don't have any trouble to run oracle datasource example
by using
...
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
env.put (Context.PROVIDER_URL, "file:/tmp/test/sampledb");
ctx = new InitialContext(env);
DataSource ods = (DataSource)ctx.lookup("jdbc/test/sampledb");
Connection conn = ods.getConnection();
...

If I put the same code in the savingaccounts example, I will run into the error
something like: cannot instanciate class RefFSContextFactory etc.
I know I am missing somthing but I don't know what exactly I am missing because I am a very beginer to JNDI and EJB.
Could anyone give some advise? Thanks very much.
/Weiqi
 
Tim Holloway
Bartender
Posts: 18663
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It says that you need a userID and/or password to connect to Oracle. It looks like maybe you didn't supply a password. I believe that it would be part of the jdbc URL(?).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!