Z
zalek
Hello,
I wrote a program that is working OK which access DB2 using the
following code:
String w_conn = "jdbc:db2
B2MAIN;
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
Connection db2Conn =
DriverManager.getConnection(w_conn,w_userid,w_passw);
Now I am reading I can access DB2 using JDNI service where code is
like this:
Connection conn = null;
try {
Context initialContext = new InitialContext();
DataSource ds = (DataSource)initialContext.lookup(w_service);
conn = ds.getConnection();
Which way is consider more efficient?
What is the variable w_service? I understand w_service is a String –
name of DB2 service, but what is a value of this string?
Thanks,
Zalek
I wrote a program that is working OK which access DB2 using the
following code:
String w_conn = "jdbc:db2
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
Connection db2Conn =
DriverManager.getConnection(w_conn,w_userid,w_passw);
Now I am reading I can access DB2 using JDNI service where code is
like this:
Connection conn = null;
try {
Context initialContext = new InitialContext();
DataSource ds = (DataSource)initialContext.lookup(w_service);
conn = ds.getConnection();
Which way is consider more efficient?
What is the variable w_service? I understand w_service is a String –
name of DB2 service, but what is a value of this string?
Thanks,
Zalek