Skip to Main Content

Java and JavaScript in the Database

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Oracle server side jdbc thin driver throws ORA-01017

742048Mar 6 2011 — edited Mar 30 2011
We upgraded our database to 11.2.0.1 from 9.2.0.6.

When we try to connect to an external database from Oracle JVM using server side jdbc thin driver, it throws invalid user id/password error.

The below test code simulates the issue and is not working on the upgraded instance. The same code is working in fine in other 11.2.0.1 instances. It worked fine before upgrade. In all cases, we are connecting to the same target database instance which is also in 11.2.0.1. It fails only on this database.

SEC_CASE_SENSITIVE_LOGON is set to false.

Any inputs will be highly appreciated.

Code:_
 
create or replace and compile java source named TestConn as 
import java.sql.SQLException; 
import oracle.jdbc.OracleDriver; 
import oracle.jdbc.OracleConnection; 
import java.sql.DriverManager; 

     
public class TestConn { 

     public  static String runTest() { 
      
      String msg = "Start"; 
      
      OracleConnection tempOC = null; 
      
      try { 
      
      String pUrl = "jdbc:oracle:thin:@dev:1521:dev"; 
      String pUser = "tst_user"; 
      String pPwd = "dummy"; 

      DriverManager.registerDriver (new oracle.jdbc.OracleDriver()); 
      tempOC = (OracleConnection)DriverManager.getConnection(pUrl, pUser, pPwd); 


msg = "Success"; 

} catch (SQLException sqle) { 

      System.out.println(sqle.toString()); 
      sqle.printStackTrace(); 
      msg = "Failure"; 
       
     } 
         
        return msg; 
           
     } 
}   
/ 

CREATE OR REPLACE FUNCTION test_conn RETURN VARCHAR2 
AS LANGUAGE JAVA 
NAME 'TestConn.runTest() return java.lang.String'; 
/ 


set serverout on 
declare 
c varchar2(4000); 
begin 
dbms_java.set_output(5000); 
c:=test_conn(); 
dbms_output.put_line(c); 
end; 
/ 
Error Message_
 

java.sql.SQLException: ORA-01017: invalid username/password; logon denied 
java.sql.SQLException: ORA-01017: invalid username/password; logon denied 
       at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:439) 
       at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:388) 
       at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:381) 
       at oracle.jdbc.driver.T4CTTIfun.processError(T4CTTIfun.java:564) 
       at oracle.jdbc.driver.T4CTTIoauthenticate.processError(T4CTTIoauthenticate.java:431) 
       at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:436) 
       at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:186) 
       at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java:366) 
       at oracle.jdbc.driver.T4CTTIoauthenticate.doOAUTH(T4CTTIoauthenticate.java) 
       at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:359) 
       at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java) 
       at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221) 
       at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) 
       at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java) 
       at java.sql.DriverManager.getConnection(DriverManager.java) 
       at java.sql.DriverManager.getConnection(DriverManager.java) 
       at TestConn.runTest(TESTCONN:22) 
Edited by: sskumar on Mar 6, 2011 1:12 PM

Comments

Lokanath Giri
wm_concat is un-documented hence not supported by oracle.
Try some alternative
select 
rtrim (xmlagg (xmlelement (e, ename || ',')).extract ('//text()'), ',') enames
from 
emp
where deptno=30
Some good example available check this.
http://www.oracle-base.com/articles/misc/StringAggregationTechniques.php

Edited by: Lokanath Giri on १० जनवरी, २०१२ १२:५४ अपराह्न
Jhon
correct name of ur Function:

SELECT lengt(ename) FROM EMP WHERE deptno=10;
ORA-00904: "LENGT": invalid identifier
00904. 00000 - "%s: invalid identifier"
*Cause:
*Action:
Error at Line: 8 Column: 7

SELECT length(ename) FROM EMP WHERE deptno=10;
it return rows sucessfully
AlexAnd
>
WM_CONCAT is undocumented and unsupported by Oracle, meaning it should not be used in production systems.
>
so change your way

btw

for me
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production

SQL> set serveroutput on
SQL> DECLARE
  2   ex varchar2(200);
  3   BEGIN
  4   SELECT wm_concat(ename) INTO EX FROM EMP WHERE deptno=30;
  5   DBMS_OUTPUT.PUT_LINE(EX);
  6   END;
  7  /
ALLEN,WARD,MARTIN,BLAKE,TURNER,JAMES

PL/SQL procedure successfully completed.

SQL> 
try wmsys.wm_concat
cool-2466583
Hi,

Please check the database version you are using.

wm_concat is available from 11g Release 2.

Regards,
Wilson
BluShadow
Answer
Cool wrote:
Hi,

Please check the database version you are using.

wm_concat is available from 11g Release 2.
Incorrect.

wm_concat is undocumented and shouldn't be used.

Even Tom Kyte says so... 9967699

From 11gR2, there is a new documented function called LISTAGG...

http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions089.htm
Marked as Answer by 883038 · Sep 27 2020
1 - 5
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Apr 27 2011
Added on Mar 6 2011
4 comments
42,795 views