[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3799
  • Last Modified:

java.sql.SQLException: Bigger type length than Maximum

00:46:12,171 INFO  [STDOUT] java.sql.SQLException: Bigger type length than Maximum
00:46:12,203 INFO  [STDOUT]     at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
00:46:12,234 INFO  [STDOUT]     at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
00:46:12,265 INFO  [STDOUT]     at oracle.jdbc.driver.DatabaseError.check_error(DatabaseError.java:885)
00:46:12,281 INFO  [STDOUT]     at oracle.jdbc.driver.T4CMAREngine.buffer2Value(T4CMAREngine.java:2231)
00:46:12,312 INFO  [STDOUT]     at oracle.jdbc.driver.T4CMAREngine.unmarshalUB2(T4CMAREngine.java:1048)
00:46:12,343 INFO  [STDOUT]     at oracle.jdbc.driver.T4CTTIdcb.receiveCommon(T4CTTIdcb.java:112)
00:46:12,375 INFO  [STDOUT]     at oracle.jdbc.driver.T4CTTIdcb.receiveFromRefCursor(T4CTTIdcb.java:104)
00:46:12,390 INFO  [STDOUT]     at oracle.jdbc.driver.T4CResultSetAccessor.unmarshalOneRow(T4CResultSetAccessor.java:16
00:46:12,421 INFO  [STDOUT]     at oracle.jdbc.driver.T4CTTIrxd.unmarshal(T4CTTIrxd.java:788)
00:46:12,453 INFO  [STDOUT]     at oracle.jdbc.driver.T4CTTIrxd.unmarshal(T4CTTIrxd.java:705)
00:46:12,484 INFO  [STDOUT]     at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:527)
00:46:12,500 INFO  [STDOUT]     at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:180)
00:46:12,531 INFO  [STDOUT]     at oracle.jdbc.driver.T4CCallableStatement.execute_for_rows(T4CCallableStatement.java:7
00:46:12,562 INFO  [STDOUT]     at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1028)
00:46:12,593 INFO  [STDOUT]     at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.j
00:46:12,625 INFO  [STDOUT]     at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:2979
00:46:12,640 INFO  [STDOUT]     at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:4103
00:46:12,671 INFO  [STDOUT]     at com.mailamerica.wts.DAO.OracleLoginDAO.login(Unknown Source)
00:46:12,703 INFO  [STDOUT]     at com.mailamerica.wts.LoginAction.execute(Unknown Source)
00:46:12,734 INFO  [STDOUT]     at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java
00:46:12,750 INFO  [STDOUT]     at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
00:46:12,781 INFO  [STDOUT]     at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
00:46:12,812 INFO  [STDOUT]     at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
00:46:12,843 INFO  [STDOUT]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
00:46:12,859 INFO  [STDOUT]     at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
00:46:12,890 INFO  [STDOUT]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterCh
00:46:12,921 INFO  [STDOUT]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java
00:46:12,953 INFO  [STDOUT]     at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
00:46:12,968 INFO  [STDOUT]     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterCh
00:46:13,000 INFO  [STDOUT]     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java
00:46:13,031 INFO  [STDOUT]     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
00:46:13,062 INFO  [STDOUT]     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
00:46:13,078 INFO  [STDOUT]     at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:
00:46:13,109 INFO  [STDOUT]     at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationVal
00:46:13,140 INFO  [STDOUT]     at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:53)
00:46:13,171 INFO  [STDOUT]     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
00:46:13,187 INFO  [STDOUT]     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
00:46:13,218 INFO  [STDOUT]     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
00:46:13,250 INFO  [STDOUT]     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
00:46:13,281 INFO  [STDOUT]     at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:307)
00:46:13,296 INFO  [STDOUT]     at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:385)
00:46:13,328 INFO  [STDOUT]     at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:748)
00:46:13,359 INFO  [STDOUT]     at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:678)
00:46:13,390 INFO  [STDOUT]     at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:871)
00:46:13,406 INFO  [STDOUT]     at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
00:46:13,437 INFO  [STDOUT]     at java.lang.Thread.run(Thread.java:595)

my DAO code is like below:

 try{
                      conn = OracleDAOFactory.createConnection();
                      String sql =
                      "{ ? = call validateUser( ? , ? ) }";

                      cstmt = conn.prepareCall(sql);
                      cstmt.registerOutParameter(1, OracleTypes.CURSOR);
                      cstmt.setString(2, username);
                      cstmt.setString(3, pswd);
                      cstmt.execute();
                            rset = (ResultSet)cstmt.getObject(1);


and my validateUser code is like below:



create or replace package types as
type sqlcur is REF cursor;
end;
/


create or replace function validateUser(
p_username               PRINCIPALS_TABLE.username%type,
p_password            PRINCIPALS_TABLE.password%type
)return types.sqlcur as
c1 types.sqlcur;

v_username               varchar2(64);
v_password            varchar2(64);

begin

v_username  := p_username;
v_password  := p_password;

OPEN c1 FOR

select
p.username ,
name_of_role       role ,
name_of_rolegroup  rolegroup ,
id_of_user
from
principals_table p ,
roles_table r,
rolegroup_info_table rgi,
role_info_table ri
where
    p.username = v_username
and p.password = v_password
and p.username = r.username
and r.id_of_rolegroup = rgi.id_of_rolegroup
and r.id_of_role  = ri.id_of_role
;

RETURN c1;


I don't see any problem here, can anybody help?

thanks
0
arthurwang
Asked:
arthurwang
  • 4
  • 3
1 Solution
 
avinthmCommented:
try using latest jdbc driver. this seems to be problem with driver and its a known bug.
0
 
arthurwangAuthor Commented:
I did copy the ojdbc14.jar from the lib directory of my oracle 10gr2 rac and put it  into the classpath of the compile server. however, when I print out the version of the jdbc driver, it still shows the version of 10.1.0.2 instead of 10.2. I don't know why! should i also need to include the classpath of ojdbc14.jar in the application server?machine used to compile the java source code is different from the applicaton server machine.
0
 
arthurwangAuthor Commented:
in fact, I just migrated from 10gr1 single node database to 10gr2 rac with two node, and all datafiles are saved by ASM, someone said it's related to characterset of the ASM, not sure if it's the problem of ASM.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
arthurwangAuthor Commented:
I just tried to put the ojdbc14.jar into the classpath of the application server lib directory, then the error message disappear.  I guess that the jdbc driver is loaded dynamically , so it has to be in the classpath of application server, is this the right reason?
0
 
avinthmCommented:
the server picks up the classes from the jar which is in classpath.
the jars from the classpath form the runtime environment.
so if u compile the code using new ojdbc14.jar ......then it doesnt work.
u will have to put it in runtime classpath.
0
 
arthurwangAuthor Commented:
I just don't understand why some components needs to be in  the classpath of run time enviroment, and some don't . is there any way I can identify this?
0
 
princedudleyCommented:
Can I know where exactly is the classpath that is mentioned by avinthm ?
I am facing the same issue.
0
 
avinthmCommented:
The classpath i am refering to is Runtime classpath. You can use -classpath option with java command to set runtime classpath.

java -classpath <path to jar files> <your class with main method>

documentation : http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/classpath.html
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now