Can you write a small wrapper class in Java containing the try-catch you
want and call that instead?


-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of James H. H. Lampert
Sent: 19. august 2013 20:12
To: Java Programming on and around the IBM i
Cc: Scott Klement
Subject: JDBCR4 (RPGLE calling Java) problem with passwords

I'm finally making enough progress with my JDBCR4 project to where I need to
concern myself with users entering a wrong user-ID and/or
password: when this happens,
conn = JDBC_ConnProp(%trim(driver)
: %trim(url_db)
: prop );
throws a Java exception. (There are almost certainly other ways to make it
throw an exception; bad values for driver or url_db spring immediately to
mind.)

With some futzing around, I was able to redirect stdout and stderr to source
PFs in QTEMP, and I got this in STDERR:
Exception in thread "main" java.sql.SQLException: The application
server rejecte d the connection. (User ID is not known.) at
com.ibm.as400.access.JDError.throwSQLException(JDError.java:558)
at
com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnec
tion.j
ava:3328)
at
com.ibm.as400.access.AS400JDBCDriver.prepareConnection(AS400JDBCDriver.java:
1393)
at
com.ibm.as400.access.AS400JDBCDriver.initializeConnection(AS400JDBCDri
ver.ja
va:1230)
at
com.ibm.as400.access.AS400JDBCDriver.connect(AS400JDBCDriver.java:371)
Caused by: com.ibm.as400.access.AS400SecurityException: User ID is not
known.
at
com.ibm.as400.access.AS400ImplRemote.returnSecurityException(AS400Impl
Remote
.java:1767)
at
com.ibm.as400.access.AS400ImplRemote.signon(AS400ImplRemote.java:2277)
at com.ibm.as400.access.AS400.sendSignonRequest(AS400.java:3051)
at com.ibm.as400.access.AS400.promptSignon(AS400.java:2615)
at com.ibm.as400.access.AS400.signon(AS400.java:3930)
at com.ibm.as400.access.AS400.connectService(AS400.java:1178)
at
com.ibm.as400.access.AS400JDBCConnection.setProperties(AS400JDBCConnec
tion.j
ava:3324)
... 3 more

Now, obviously, if I were doing this in Java, I'd put it in a try/catch
block. But what about calling from RPG?

--
JHHL
--
This is the Java Programming on and around the IBM i (JAVA400-L) mailing
list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/java400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.