Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / October 2004

Tip: Looking for answers? Try searching our database.

? connect to db2 as400 server

Thread view: 
progprob - 01 Oct 2004 22:15 GMT
i'm new to database connectivity through java.

can u help/guide  me how to connect to db2 as400 server(os 400) from
client windows/linux terminal through jdbc .

i'v downloaded the jdbc db2 driver from i-net .

tell me the specification regarding where to place the
drivers,classes,libraries etc.

Do i need to edit or create the database.properties file

thanks

-
progpro
-----------------------------------------------------------------------
Dieter Bender - 02 Oct 2004 18:22 GMT
Hi,

you need another driver, you'll find it at
http://www-1.ibm.com/servers/eserver/iseries/toolbox/downloads.htm
its an pure java driver and runs on any java system. The driver class is
com.ibm.access.AS400JDBCDriver
the url you need is
jdbc:as400://HostName/DefaultSchema

Dieter Bender

> i'm new to database connectivity through java.
>
[quoted text clipped - 15 lines]
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------
Alberto - 08 Oct 2004 09:42 GMT
> i'v downloaded the jdbc db2 driver from i-net .

Hello !

No, you need to download jt400.jar library, if you have IBM Client Access
installed try to search that file.

Then, the connection method is rather simple, see my sample code below ( you
have to change some line to get it works )

/* (non-Javadoc)
 * @see jdbconn.model.dbengine#openConnection()
 */
public Connection openConnection(String IP,String DBname,String UID,String
PSW) {

 this.server = IP;
 this.dbName = DBname;
 this.uid = UID;

 Connection db2Conn = null;
 try {
             DriverManager.registerDriver(new
com.ibm.as400.access.AS400JDBCDriver());
             db2Conn =
DriverManager.getConnection("jdbc:as400://"+IP+"/"+DBname+";user="+UID+";pas
sword="+PSW);
             return db2Conn;
        } catch (SQLException e) {
           System.out.println("Error while connecting to "+IP+" with
user="+UID);
           System.out.println("SQLException: "+e.getMessage());
           System.out.println("SQLState: "+e.getSQLState());
           System.out.println("Vendor Error: "+e.getErrorCode());
       return null;
        }
}

Hoping this helps,
ciao
Alberto


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.