aspose file tools*
The moose likes Oracle/OAS and the fly likes WSAD-Oracle10 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Oracle/OAS
Bookmark "WSAD-Oracle10" Watch "WSAD-Oracle10" New topic
Author

WSAD-Oracle10

Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
hi friends,

I've configured my WSAD in order to communicate to the Oracle 10.I created a servlet which will try to connect to the database (orcl).When i run the servlet i get the following error.

java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:localhost:1521 orcl


what could be the reason???I'm new to oracle.....But project doesn't care what is new and what is not

Thanks in advance

prashanth
Ganpi Srinivasan
Ranch Hand

Joined: Aug 17, 2005
Posts: 160
How have you defined the Oracle datasource - are you using an OCI driver or thin driver? From the message it looks like you are trying to using the thin driver. In that case, check the URL format:

jdbc: oracle:thin:@MyOracleServer:1521:MyDBSID

Note: there is a space between the words "java:" and "oracle". Please remove that while constructing the URL

Cheers!
[ November 16, 2006: Message edited by: Ganpi Srinivasan ]
Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
hi srinivasan,
Thanks for the reply

1) Yes im using Oracle thin drive.I manipulated the URL by prviding a space between jdbc: oracle.

jdbc: oracle:thin:@localhost:1521 rcl but no luck

2)when i try to connect im getting the exception saying data source not found hence using the default setup.I've pasted the exception.But i've configured the datasource in WSAD.but still why this exception???.Wondering where could be the problem.....

[11/17/06 7:01:06:656 GST] 27e07a33 ConnectionFac I J2CA0122I: Resource reference jdbc/MyDataSource could not be located, so default values of the following are used: [Resource-ref settings]

res-auth: 1 (APPLICATION)
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
res-resolution-control: 999 (undefined)

[11/17/06 7:01:07:016 GST] 27e07a33 FreePool E J2CA0046E: Method createManagedConnctionWithMCWrapper caught an exception during creation of the ManagedConnection for resource jdbc/MyDataSource, throwing ResourceAllocationException. Original exception: com.ibm.ws.exception.WsException: DSRA8100E: Unable to get a PooledConnection from the DataSource.
at com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.<init>(DataStoreAdapterException.java:251)
at com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.<init>(DataStoreAdapterException.java:172)
at com.ibm.ws.rsadapter.AdapterUtil.createDataStoreAdapterException(AdapterUtil.java:182)
at com.ibm.ws.rsadapter.DSConfigurationHelper.getPooledConnection(DSConfigurationHelper.java:663)
at com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooledConnection(WSRdbDataSource.java:189)
at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:503)
at com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1106)
at com.ibm.ejs.j2c.poolmanager.FreePool.createOrWaitForConnection(FreePool.java:897)
at com.ibm.ejs.j2c.poolmanager.PoolManager.reserve(PoolManager.java:1065)
at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:560)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:374)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:205)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:180)
at ConnectionServlet.doGet(ConnectionServlet.java:28)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:258)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:872)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:491)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:173)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:199)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
---- Begin backtrace for nested exception
java.sql.SQLException: Invalid Oracle URL specified
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:161)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:226)
at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:196)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:108)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:76)
at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:58)
at com.ibm.ws.rsadapter.DSConfigurationHelper$1.run(DSConfigurationHelper.java:643)
at java.security.AccessController.doPrivileged(Native Method)
at com.ibm.ws.rsadapter.DSConfigurationHelper.getPooledConnection(DSConfigurationHelper.java:638)
at com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooledConnection(WSRdbDataSource.java:189)
at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:503)
at com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1106)
at com.ibm.ejs.j2c.poolmanager.FreePool.createOrWaitForConnection(FreePool.java:897)
at com.ibm.ejs.j2c.poolmanager.PoolManager.reserve(PoolManager.java:1065)
at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:560)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:374)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:205)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:180)
at ConnectionServlet.doGet(ConnectionServlet.java:28)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:258)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:872)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:491)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:173)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:199)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:182)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432)
at com.ibm.ws.http.HttpConnection.run(

thanks and regards

prashanth
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

You're on the right track, I picked out the root exception from that big stack trace:
Invalid Oracle URL specified
I'm a bit surprised, when I've configured data sources in Websphere servers you just give it the information like what kind of driver it is and where the database server is and then Websphere takes care of building the URL. Don't see how that could produce an invalid URL. But if you're building the URL yourself, I have never seen a JDBC URL that didn't have slashes in it, something like this:I say something like that because I haven't used Oracle. But there should be documentation with the driver that goes into those details. Guessing is a slow process.

I could move this thread to the Oracle forum if you like. Just ask.
Ganpi Srinivasan
Ranch Hand

Joined: Aug 17, 2005
Posts: 160
Okay. Couple of things:

1. Your URL mentioned "localhost" as the Oracle host server. Is your oracle server running on the same box as the websphere server?

2. If they are running on the same server, try using the server name instead of "localhost".

3. Is "orcl" the SID for your database?

4. Also, as mentioned in my earlier email, try using native OCI driver. We have been seeing in our organization some issues while connecting to Oracle 10g server using the thin driver.

Good luck!
[ November 17, 2006: Message edited by: Ganpi Srinivasan ]
Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
Hi friends,

Sorry for the late reply.Yes my appserver and database server are in the same machine.Yes my SID is ORCL(one can find what is appended to oracleService)

I'm using WSAD5.0 with Oracle10g.I've a datbase access code in the servlet.I'm unable to access the database.Below i've clearly mentioned what setup is made at my side....
Appserver and database server are in the same machine

1)In Web.xml i've made the entries as below

<resource-ref id="ResourceRef_1164695602844">
<res-ref-name>MyDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

2)The code in my servlet is

public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
javax.sql.DataSource ds = null;
java.sql.Connection con = null;
java.io.PrintWriter out = resp.getWriter();
resp.setContentType("text/html");
try {
out.println("Looking up DataSource
");
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
ds = (javax.sql.DataSource) ctx.lookup("jdbc/MyDataSource");
out.println("Getting connection
");
con = ds.getConnection();
//con = ds.getConnection("sys","prashanth");
//con = ds.getConnection("scott","tiger");
out.println("error here
");
con.close();
} catch (Exception e) {
out.println("Not Done
");
e.printStackTrace(out);
}
out.println("Done
");
}

3)In Datasource setting is using Oracle JDBC thin driver.
JNDI name is --> jdbc/MyDataSource
URL is --> jdbc racle:thin:@personal-030464:1521 RCL


Note: using sys/password i can log in to enterprise manager (http://personal-030464:5500/em).

but while accesing the servlet on the browser
the error displayed on the browser is as below
Looking up DataSource
Getting connection
Not Done
java.sql.SQLException: ORA-01017: invalid username/password; logon denied at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271) at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:644) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:298) at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:343) at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:147) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:31) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:545) at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:193) at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:108) at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:76) at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:58) at com.ibm.ws.rsadapter.DSConfigurationHelper$1.run(DSConfigurationHelper.java:643) at java.security.AccessController.doPrivileged(Native Method) at com.ibm.ws.rsadapter.DSConfigurationHelper.getPooledConnection(DSConfigurationHelper.java:638) at com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooledConnection(WSRdbDataSource.java:189) at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:503) at com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1106) at com.ibm.ejs.j2c.poolmanager.FreePool.createOrWaitForConnection(FreePool.java:897) at com.ibm.ejs.j2c.poolmanager.PoolManager.reserve(PoolManager.java:1065) at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:560) at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:374) at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:205) at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:180) at ConnectionServlet.doGet(ConnectionServlet.java:28) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110) at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174) at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313) at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116) at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:258) at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42) at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:872) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:491) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:173) at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79) at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:199) at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71) at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114) at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.javer a:187) at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331) at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56) at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432) at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592) Done


and on the server log has listed out the exceptions as below.

[11/28/06 12:47:52:078 GST] 4f75a2fa ConnectionFac I J2CA0122I: Resource reference jdbc/MyDataSource could not be located, so default values of the following are used: [Resource-ref settings]

res-auth: 1 (APPLICATION)
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
res-resolution-control: 999 (undefined)

[11/28/06 12:47:52:234 GST] 4f75a2fa FreePool E J2CA0046E: Method createManagedConnctionWithMCWrapper caught an exception during creation of the ManagedConnection for resource jdbc/MyDataSource, throwing ResourceAllocationException. Original exception: com.ibm.ws.exception.WsException: DSRA8100E: Unable to get a PooledConnection from the DataSource.
at com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.<init>(DataStoreAdapterException.java:251)
at com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.<init>(DataStoreAdapterException.java:172)
at com.ibm.ws.rsadapter.AdapterUtil.createDataStoreAdapterException(AdapterUtil.java:182)
at com.ibm.ws.rsadapter.DSConfigurationHelper.getPooledConnection(DSConfigurationHelper.java:663)
at com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooledConnection(WSRdbDataSource.java:189)
at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:503)
at com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1106)
at com.ibm.ejs.j2c.poolmanager.FreePool.createOrWaitForConnection(FreePool.java:897)
at com.ibm.ejs.j2c.poolmanager.PoolManager.reserve(PoolManager.java:1065)
at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:560)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:374)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:205)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:180)
at ConnectionServlet.doGet(ConnectionServlet.java:28)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:258)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:872)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:491)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:173)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:199)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:187)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
---- Begin backtrace for nested exception
java.sql.SQLException: ORA-01017: invalid username/password; logon denied

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271)


I'm unable to understand where the problem is???.Thanks in advance

regards

prashanth
Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
Hi friends,

Sorry for the late reply.Yes my appserver and database server are in the same machine.Yes my SID is ORCL(one can find what is appended to oracleService)

I'm using WSAD5.0 with Oracle10g.I've a datbase access code in the servlet.I'm unable to access the database.Below i've clearly mentioned what setup is made at my side....
Appserver and database server are in the same machine

1)In Web.xml i've made the entries as below

<resource-ref id="ResourceRef_1164695602844">
<res-ref-name>MyDataSource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

2)The code in my servlet is

public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
javax.sql.DataSource ds = null;
java.sql.Connection con = null;
java.io.PrintWriter out = resp.getWriter();
resp.setContentType("text/html");
try {
out.println("Looking up DataSource
");
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
ds = (javax.sql.DataSource) ctx.lookup("jdbc/MyDataSource");
out.println("Getting connection
");
con = ds.getConnection();
//con = ds.getConnection("sys","prashanth");
//con = ds.getConnection("scott","tiger");
out.println("error here
");
con.close();
} catch (Exception e) {
out.println("Not Done
");
e.printStackTrace(out);
}
out.println("Done
");
}

3)In Datasource setting is using Oracle JDBC thin driver.
JNDI name is --> jdbc/MyDataSource
URL is --> jdbc racle:thin:@personal-030464:1521 RCL


Note: using sys/password i can log in to enterprise manager (http://personal-030464:5500/em).

but while accesing the servlet on the browser
the error displayed on the browser is as below
Looking up DataSource
Getting connection
Not Done
java.sql.SQLException: ORA-01017: invalid username/password; logon denied at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271) at oracle.jdbc.driver.T4CTTIoauthenticate.receiveOauth(T4CTTIoauthenticate.java:644) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:298) at oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:343) at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:147) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:31) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:545) at oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:193) at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPhysicalConnection(OracleConnectionPoolDataSource.java:108) at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:76) at oracle.jdbc.pool.OracleConnectionPoolDataSource.getPooledConnection(OracleConnectionPoolDataSource.java:58) at com.ibm.ws.rsadapter.DSConfigurationHelper$1.run(DSConfigurationHelper.java:643) at java.security.AccessController.doPrivileged(Native Method) at com.ibm.ws.rsadapter.DSConfigurationHelper.getPooledConnection(DSConfigurationHelper.java:638) at com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooledConnection(WSRdbDataSource.java:189) at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:503) at com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1106) at com.ibm.ejs.j2c.poolmanager.FreePool.createOrWaitForConnection(FreePool.java:897) at com.ibm.ejs.j2c.poolmanager.PoolManager.reserve(PoolManager.java:1065) at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:560) at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:374) at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:205) at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:180) at ConnectionServlet.doGet(ConnectionServlet.java:28) at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110) at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174) at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313) at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116) at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:258) at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42) at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:872) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:491) at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:173) at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79) at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:199) at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71) at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114) at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.javer a:187) at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331) at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56) at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432) at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592) Done


and on the server log has listed out the exceptions as below.

[11/28/06 12:47:52:078 GST] 4f75a2fa ConnectionFac I J2CA0122I: Resource reference jdbc/MyDataSource could not be located, so default values of the following are used: [Resource-ref settings]

res-auth: 1 (APPLICATION)
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
res-resolution-control: 999 (undefined)

[11/28/06 12:47:52:234 GST] 4f75a2fa FreePool E J2CA0046E: Method createManagedConnctionWithMCWrapper caught an exception during creation of the ManagedConnection for resource jdbc/MyDataSource, throwing ResourceAllocationException. Original exception: com.ibm.ws.exception.WsException: DSRA8100E: Unable to get a PooledConnection from the DataSource.
at com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.<init>(DataStoreAdapterException.java:251)
at com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException.<init>(DataStoreAdapterException.java:172)
at com.ibm.ws.rsadapter.AdapterUtil.createDataStoreAdapterException(AdapterUtil.java:182)
at com.ibm.ws.rsadapter.DSConfigurationHelper.getPooledConnection(DSConfigurationHelper.java:663)
at com.ibm.ws.rsadapter.spi.WSRdbDataSource.getPooledConnection(WSRdbDataSource.java:189)
at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.createManagedConnection(WSManagedConnectionFactoryImpl.java:503)
at com.ibm.ejs.j2c.poolmanager.FreePool.createManagedConnectionWithMCWrapper(FreePool.java:1106)
at com.ibm.ejs.j2c.poolmanager.FreePool.createOrWaitForConnection(FreePool.java:897)
at com.ibm.ejs.j2c.poolmanager.PoolManager.reserve(PoolManager.java:1065)
at com.ibm.ejs.j2c.ConnectionManager.allocateMCWrapper(ConnectionManager.java:560)
at com.ibm.ejs.j2c.ConnectionManager.allocateConnection(ConnectionManager.java:374)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:205)
at com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource.getConnection(WSJdbcDataSource.java:180)
at ConnectionServlet.doGet(ConnectionServlet.java:28)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.IdleServletState.service(StrictLifecycleServlet.java:313)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:258)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:872)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:491)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:173)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:79)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:199)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:187)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:331)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:432)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:343)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:592)
---- Begin backtrace for nested exception
java.sql.SQLException: ORA-01017: invalid username/password; logon denied

at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:124)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:304)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:271)


I'm unable to understand where the problem is???.Thanks in advance

regards

prashanth
Ganpi Srinivasan
Ranch Hand

Joined: Aug 17, 2005
Posts: 160
Prasanth,
As you might notice, now you are able to connect to the DB but Oracle is refusing connection because of an invalid user id/password combination.

In your server configuration, click on the security tab and create a JAAS Authentication entry. This would comprise of:

1. An Alias name that would refer to in the datasource
2. User id - user id that you would use to connect to the DB
3. Password - password for the DB user id.

Once you have created these, go to your Datasource tab and click on your specific oracle datasource and click on Edit. In the edit window you would see 2 entries (all the way at the bottom) for Component managed authentication alias and Container managed auth alias. In the dropdown for these entries you would now see the alias you had created in the security tab. Select them and click on OK.

Now, save your server config, restart your server and execute your code. It should work now.

Cheers and Good luck!
Ganpi
Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
Hi Ganpi,
Thanks alot....
I've already done all the settings you have suggested me to do before posting the last reply.I think this leaves me to think on,should i be using sys/password or i must use scott/tiger to access the database.This comment may look sily but still wanted to put across my views.I've very minimum knowledge in oracle....
One more thing when i google there are many guide lines on setting up oracle9i/oracle 8i on WSAD.But dint find any for Oracle10G.Then is it WSAD5.0 can be married to Oracle 10G ???

Let me explain what settings i've done
Under Security-->JAAS Authentication entry
AliasDatabase user
User id sys
passwordprashanth
Under Data source Server Settings-->JDBC Provider List
NameOracle thin driver
Implementation class name= oracle.jdbc.pool.OracleConnectionPoolDataSource
class pathORACLE_JDBC_DRIVER_PATH/classes12.zip

Modify data source
component managed authentication aliasatabase user
container managed authentication aliasatabase user
I have unchecked the checkbox use this datasource in CMP.
JNDI Name:jdbc/MyDataSource
Resource properties defined in the data source selected above:
URLjdbc racle:thin:@personal-030464:1521 RCL
Port number1521
Thanks in advance

Prashanth
Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
Hi Friends,

Can somebosy help me out in resolving this problem......

Thanks in advance

Regards

Prashanth
Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
Hi Friends,

I got the solution.Oracle database canot be accesed with sys schema.This schema will be used by the database for critical operations by itself.
In Enterprise manager console i created a new user profile say "prashanth/prashanth".Then used this profile in JAAS security setup.

Hope this helps someone sooner or the later.

Thanks and reagrds
Prashanth
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18987
    
    8

Glad you got the solution, Prashanth. But it looks like it was an Oracle problem after all. So in the hope that it may help somebody else, I will move the entire thread over to the Oracle forum.
Prashanth Bhanu
Ranch Hand

Joined: Sep 25, 2003
Posts: 110
Hi Paul,

Yes Paul,This issue is more relevent to oracle than WSAD.Thanks...

Thanks and reagrds

Prashanth
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: WSAD-Oracle10