- Tags: shared server process, shared server process
- Interpretation: shared server process is a database connection technology of Oracle, similar to dedicated mode and DRCP
★ Database configuration
alter system set shared_server_sessions=1 scope=spfile;
alter system set max_shared_servers=1 scope=spfile;
alter system set shared_servers=1 scope=spfile;
alter system set max_dispatchers=1 scope=spfile;
alter system set dispatchers='(PROTOCOL=TCP)(DISPATCHERS=1)' scope=spfile;
★ Java code
package PAC_001;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.SQLException;
import oracle.jdbc.pool.OracleDataSource;
public class CLA_oracle {
public static void main(String args[]) throws SQLException {
OracleDataSource ods = null;
Connection conn = null;
Statement stmt = null;
ResultSet rset = null;
ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@1.1.1.9:1521/prodpdb1:shared");
ods.setUser("zzt");
ods.setPassword("zzt");
conn = ods.getConnection();
try {
stmt = conn.createStatement();
rset = stmt.executeQuery("SELECT count(*) FROM zzt.emp");
while (rset.next())
System.out.println(rset.getString(1));
}
finally {
if (rset != null)
rset.close();
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
}
}
}
※ If you think the article is well written, don't forget to give the author a thumbs up at the end of the article~