Problem solve Get help with specific problems with your technologies, process and projects.

Using DB2 Connect and Java to connect to AS/400

Do you have any specific coding examples of using DB2 Connect and Java to connect to an AS/400. I was using the...

AS/400 Toolbox (that worked OK), but need to switch to DB2 Connect (our standard). I keep getting this message:

"jdbc:db2://VGIBKP1|stacktrace=|stack=java.sql.SQLException: No suitable driver; at java.sql.DriverManager.getConnection(DriverManager.java:477)". I'm not really sure my local host format is correct. Can you put in a URL? Or, is it the machine name or RDB name?

I've only used DB2 Connect with S390 and Smalltalk. I think it IS a good product that was very useful when we wanted flexibility in where to send our data....

I'm sorry I don't have a DB2 Connect example for you for JDBC specifically. Given that DB2 Connect IS defining a local name for the remote database, I assume it would use the same naming convention as the local DB2 protocol:


IF that is NOT the correct protocol, try:


This is the format you appear to already have tried.

On the JDBC side, you CAN specify WHICH driver to load rather than let the DriverManager try to make the decision based on the URL and the registered drivers he has access to (that's the preferred model for locating the right driver for a URL format )....

Here's the normal way to access a driver ..

java.sql.Driver aDriver =
java.sql.Connection aDbConnection =
aDriver.connect(aUrl, properties);

Here's a direct access of the DB2 UDB driver ...

java.sql.Driver aDriver = (java.sql.Driver)
java.sql.Connection aDbConnection =
aDriver.connect(aUrl, properties);

Also, the AS/400 Java Toolkit supports JDBC 2.0, is a type 4 driver and, therefore, supports J2SE, J2EE. My understanding of DB2 Connect is that it currently is back at JDK 1.1.8. Check the IBM DB2 site to see if they have any new updates on DB2 Connect. I definitely do all our development on Java 2, especially any server Java for Web applications...

Sorry I didn't have a specific DB2 Connect example...

Jim Mason

This was last published in April 2001

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.