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