sqlj

Category: Java SE
 
seanalex
2011-04-20 07:18:21

Sponsored Links
Each Gap:
brother needs to ask the following questions:
1. Use sqlj how to connect directly to the use of DB has been built connection, online information are such
DefaultContext myContext1 = Oracle.getConnection
; ("jdbc: oracle: oci8 @ MYSERVER_ORCL", "scott", "tiger");
DefaultContext myContext2 = Oracle.getConnection
("jdbc: oracle : oci8 @ MYSERVER_ORCL "," tom "," bear ");
example, I have two connection pool
How can I make use of my two sqlj pool directly specified connection?
2. How can I just write a java implementation and interface developed in the program is to achieve the interface of the class
; the name of the class can call the corresponding class way, thank you ......


Sponsored Links

lizhan26039087
2011-04-20 07:32:59

did not understand the first question could be considered a second factory pattern,

public class Factory {

public static Sample ; creator (int which) {

/ / getClass produce Sample generally use dynamic class loading into categories.
if (which == 1)
return new SampleA ();
else if (which == 2)
return new SampleB ();

}

}
then in your program, if you want to instantiate the Sample. then use

Sample sampleA = Factory.creator (1);

In this way, the whole is not involved Sample concrete subclasses achieve encapsulation effect, thus reducing the chance of error correction, this principle can be used to describe a very popular words : is the specific things done, the more likely Fan error.
haoyu2527
2011-04-20 07:51:42
up 2 u
Domain and server ip had changed since 8/23/2013. Suspend the user registration and posts for program maintenance.