|
-
Aug 5th, 2002, 08:23 AM
#1
Thread Starter
Addicted Member
Java connection using DB2 - How?
Hi,
I'm developing a new system for internet.
How can I connect to a DB2 database?
My code is below:
public abstract class Repository {
private static final String DRIVER = "COM.ibm.db2.jdbc.net.DB2Driver";
private static final String URL = "jdbc:db2 301:1000";
private static final String USER = "john";
private static final String PASSWORD = "12345";
protected Connection obterConexao() throws RepositoryException {
Connection con = null;
try {
Class.forName(DRIVER);
} catch(ClassNotFoundException cnfe) {
System.err.println("Error on loading driver: " + cnfe.getMessage());
}
try {
con = DriverManager.getConnection(URL, USER, PASSWORD);
} catch (SQLException sqle) {
System.err.println("Error on getting connection: " + sqle);
}
Can anybody help me with a good example?
Thanks in advance
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|