The value of JDBCSpecs and JDBCDriver are as in the original email.


This is old IBM VAJ Persistence Builder technology used for object-relational 
mapping in this application (a 2000-01 application).


I include three methods:



     This is a callback method in a subclass of Persistence Builder (PB) 
SqlDataStore, which the PB uses to get the connection specification information 
(driver, URL)


The method that uses the information provided in (1) in order to perform the 


(3) The method 
that actually invokes DriverManager.getConnection()


It is hard to provide a stack trace since the Persistence Builder framework 
"eats" the SQLException and returns a higher-level exception within the reason 
only but no stack trace. Even the highest level PB trace level does not return 
the exception. If this were not platform-specific I would get the stack trace 
by running in debug mode from within WSAD, but now on iSeries debugging is much 
harder and I've actually never done it.








public getConnectionSpec() {

DatabaseConnectionSpec aConnectionSpec;

//get server name using the Utils method and don't let it be hardcoded 

String serverName = npmt.srv.common.Utils.getServer().trim();

int delimPosition = Environment.getJDBCSpecs().indexOf("|");

String driverName = Environment.getJDBCDriver();

String dataSourceName =

Environment.getJDBCSpecs().substring(0, delimPosition)

+ serverName

+ Environment.getJDBCSpecs().substring(delimPosition + 1);

System.out.println("DEBUG: driver name: " + driverName);

System.out.println("DEBUG: data source name: " + dataSourceName);

aConnectionSpec = 

new DatabaseConnectionSpec("VA1", driverName, dataSourceName);

return aConnectionSpec;




protected Object createConnectionWithAlias(String anAlias, DatabaseLogonSpec 
aLogonSpec) {

DatabaseConnection conn = null;

DatabaseConnectionSpec aSpec = (DatabaseConnectionSpec) 


try {

conn = getConnectionPolicy().connect(aSpec);


} catch (SQLException ex1) {

Trace.showException(ex1, this, "createConnectionWithAlias()");

errorConnectionFailed(getConnectionSpec().getDriverName(), ex1.getMessage());

} catch (ClassNotFoundException ex2) {

Trace.showException(ex2, this, "createConnectionWithAlias()");


} catch (Exception ex3) {

Trace.showException(ex3, this, "createConnectionWithAlias()");


return conn;



* Attempt to connect using the supplied logon and connection specs


public synchronized void connectToDataSource() throws SQLException {

DatabaseLogonSpec aLogonSpec = getConnectionSpec().getLogonSpec();

if (aLogonSpec == null)

throw (new SQLException(resobjectExtender.getString("incorrectLogon"),"08004"));

String anId = aLogonSpec.getId();

String aPassword = aLogonSpec.getPassword();

if (aLogonSpec.isValid()) {

try {

setJdbcConnection(DriverManager.getConnection(getConnectionUrl(), anId, 

} catch (SQLWarning warn) { 





else { /* This never makes it to the driver, so return a meaningful exception */

throw (new 







* This method will return a connection object after successfully connecting

* using the supplied connection info.


public DatabaseConnection connect () throws SQLException, 
ClassNotFoundException {

DatabaseConnection connection;

JDBCConnectionManager databaseManager;

databaseManager = JDBCConnectionManager.singleton();


connection = databaseManager.getConnectionAtAlias(getAlias()); /* Check to see 
if a connection with this alias already exists */

if ( connection != null ) {

if (connection.getConnectionSpec().matches(this))

return connection;


connection = databaseManager.connectUsingSpec (this);

// If this connection has an alias, register it

if (getAlias()!= null)


return connection;


Rune Kaus <rune@xxxxxxx> wrote:
If you have a snippet of your code to share with us, and maybe a stack
trace, it would help the investigation.


PS. You are of course sure that the username and password is correct.
Panagiotis Varlagas wrote:

When attempting to use the native iSeries JDBC driver to access the local 
iSeries DB2 db, I get the following SQLException:

"The Username and/or password supplied is incorrect." (SQL1403N) 

The JDBC Driver used is:

and the URL string is: 


The configuration is a Java application and a DB2 both on the _same_ iSeries 
(AS/400) machine.

I have tried different renditions of the URL string, in particular:
1) With *LOCAL instead of MYDATABASE and
2) Without the user and password properties
Four (4) combinations in all. In all four cases the above error ("The Username 
and/or password supplied is incorrect.") was gotten!

(Reminder: Both Java app and DB2 db live on the same iSeries box)

Any help as to (i) why this error occurs and (ii) how it can be eliminated 
would be _greatly_ appreciated!!!

Panagiotis Varlagas
Senior Software Developer, NovaBank S.A.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2022 by 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.