You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Judy Dobry <jd...@calmail.berkeley.edu> on 2006/05/25 20:14:53 UTC

Problem setting up an Oracle 8 datasource

Hi,

I am trying to set up a datasouce for an Oracle 8 database.


Unfortunately, I get the following error when I try to get a connection:

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create 
PoolableConnectionFactory (ORA-00911: invalid character)


I have the following setup:

JDBC DRIVER:
I have put classes12.zip renamed to classes12.jar 
in  $CATALINA_HOME/common/lib.

$CATALINA_HOME/conf/context.xml contains:
<Context>
<Resource
     auth="Container"
     description="DB Connection"
     name="jdbc/testDB"
     type="javax.sql.DataSource"
     password="test"
     driverClassName="oracle.jdbc.driver.OracleDriver"
     maxIdle="2"
     maxWait="5000"
     username="test"
     url="jdbc:oracle:thin:@grad.berkeley.edu:1521:GD1T"
     maxActive="4"/>
     <!-- Default set of monitored resources -->
     <WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>

WEB.XML contains:
<resource-ref>
      <description>
       Test Database
      </description>
      <res-ref-name>
        jdbc/testDB
      </res-ref-name>
      <res-type>
       javax.sql.DataSource
      </res-type>
      <res-auth>
       Container
      </res-auth>
     </resource-ref>

THE CODE:

Context ctx = new InitialContext();
Context envContext = (Context)ctx.lookup("java:/comp/env");
ds =(javax.sql.DataSource) envContext.lookup( "jdbc/testDB");
try {
	System.out.println("GLOWUtil.isAuthorized - try first getConnection...");
	conn = ds.getConnection();
} catch (java.sql.SQLException ee) {
	System.out.println("GLOWUtil.isAuthorized - first getConnection:" + ee);
	System.out.println("GLOWUtil.isAuthorized - try second getConnection...");
	try {
		conn = ds.getConnection();
	} catch (java.sql.SQLException eee) {
		System.out.println("GLOWUtil.isAuthorized - second getConnection:" + eee);
		return isAuthorized;
	}
				
}

THE COMPLETE ERROR MESSAGE:
GLOWUtil.isAuthorized - first 
getConnection:org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create 
PoolableConnectionFactory (ORA-00911: invalid character)

GLOWUtil.isAuthorized - try second getConnection...
GLOWUtil.isAuthorized - second 
getConnection:org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create 
PoolableConnectionFactory (ORA-00911: invalid character)

Any suggestions would be much appreciated.

Thanks,

Judy 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Problem setting up an Oracle 8 datasource

Posted by Tim Lucia <ti...@yahoo.com>.
I would chase down the ORA-00911 error myself.  Here is a working snippet
from my web.xml which also connects to Oracle 8i using the 1.2 thin driver:

  <Resource
    name="jdbc/db"
    type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    url="jdbc:oracle:thin:@localhost:1521:db"
    username="scott"
    password="tiger"
    validationQuery="SELECT COUNT(*) FROM DUAL"
    initialSize="5"
    defaultCatalog="db"
    maxIdle="25"
    maxWait="5000"
    maxActive="50"/>  


Do you perhaps have funky characters in your username, or password, or some
other field which you obfuscated prior to posting?  (I can connect to this
server, BTW, but don't have credentials to log in, so I'm guess this is
where the invalid character(s) are.)

ORA-00911:	invalid character
Cause:	Special characters are valid only in certain places. If special
characters other than $, _, and # are used in a name and the name is not
enclosed in double quotation marks ("), this message will be issued. One
exception to this rule is for database names; in this case, double quotes
are stripped out and ignored.
Action:	Remove the invalid character from the statement or enclose the
object name in double quotation marks.



Tim 

-----Original Message-----
From: Judy Dobry [mailto:jdobry@calmail.berkeley.edu] 
Sent: Thursday, May 25, 2006 2:15 PM
To: users@tomcat.apache.org
Subject: Problem setting up an Oracle 8 datasource

Hi,

I am trying to set up a datasouce for an Oracle 8 database.


Unfortunately, I get the following error when I try to get a connection:

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create
PoolableConnectionFactory (ORA-00911: invalid character)


I have the following setup:

JDBC DRIVER:
I have put classes12.zip renamed to classes12.jar 
in  $CATALINA_HOME/common/lib.

$CATALINA_HOME/conf/context.xml contains:
<Context>
<Resource
     auth="Container"
     description="DB Connection"
     name="jdbc/testDB"
     type="javax.sql.DataSource"
     password="test"
     driverClassName="oracle.jdbc.driver.OracleDriver"
     maxIdle="2"
     maxWait="5000"
     username="test"
     url="jdbc:oracle:thin:@grad.berkeley.edu:1521:GD1T"
     maxActive="4"/>
     <!-- Default set of monitored resources -->
     <WatchedResource>WEB-INF/web.xml</WatchedResource>
</Context>

WEB.XML contains:
<resource-ref>
      <description>
       Test Database
      </description>
      <res-ref-name>
        jdbc/testDB
      </res-ref-name>
      <res-type>
       javax.sql.DataSource
      </res-type>
      <res-auth>
       Container
      </res-auth>
     </resource-ref>

THE CODE:

Context ctx = new InitialContext();
Context envContext = (Context)ctx.lookup("java:/comp/env");
ds =(javax.sql.DataSource) envContext.lookup( "jdbc/testDB");
try {
	System.out.println("GLOWUtil.isAuthorized - try first
getConnection...");
	conn = ds.getConnection();
} catch (java.sql.SQLException ee) {
	System.out.println("GLOWUtil.isAuthorized - first getConnection:" +
ee);
	System.out.println("GLOWUtil.isAuthorized - try second
getConnection...");
	try {
		conn = ds.getConnection();
	} catch (java.sql.SQLException eee) {
		System.out.println("GLOWUtil.isAuthorized - second
getConnection:" + eee);
		return isAuthorized;
	}
				
}

THE COMPLETE ERROR MESSAGE:
GLOWUtil.isAuthorized - first 
getConnection:org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create 
PoolableConnectionFactory (ORA-00911: invalid character)

GLOWUtil.isAuthorized - try second getConnection...
GLOWUtil.isAuthorized - second 
getConnection:org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create 
PoolableConnectionFactory (ORA-00911: invalid character)

Any suggestions would be much appreciated.

Thanks,

Judy 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org