Обсуждение: use connection pooling
i am tring to use connection pooing with postgresql but i was unable to found complete example about that.
got some idea from the documentation, but i was unable to run the given example.
please help me to getting start..
thanks....
got some idea from the documentation, but i was unable to run the given example.
please help me to getting start..
thanks....
Jdbc3PoolingDataSource source = new Jdbc3PoolingDataSource();
source.setDataSourceName("A Data Source");
source.setServerName ("localhost");
source.setDatabaseName("test");
source.setUser("testuser");
source.setPassword("testpassword");
source.setMaxConnections(10);
Connection con = null;
try {
con = source.getConnection();
// use connection
} catch (SQLException e) {
// log error
} finally {
if (con != null) {
try { con.close(); } catch (SQLException e) {}
}
}
hi all
my database server is running on one machine and the application is running on another machine(simple java application use to access the database).
so i want to know, what is the protocol that use to communicate between those two applications...?
thank you..
my database server is running on one machine and the application is running on another machine(simple java application use to access the database).
so i want to know, what is the protocol that use to communicate between those two applications...?
thank you..
janaka priyadarshana wrote: > hi all > > > my database server is running on one machine and the application is > running on another machine(simple java application use to access the > database). > > so i want to know, what is the protocol that use to communicate between > those two applications...? JDBC. -- Guy Rouillier
Guy Rouillier wrote: > janaka priyadarshana wrote: >> hi all >> >> >> my database server is running on one machine and the application is >> running on another machine(simple java application use to access the >> database). >> >> so i want to know, what is the protocol that use to communicate >> between those two applications...? > > JDBC. > not exactly. JDBC is the API your app uses to access the database. the JDBC class libraries for postgres on the client system will use postgres's native protocol to talk to the PG Server (default of 5432/tcp)
John R Pierce wrote: > Guy Rouillier wrote: >> janaka priyadarshana wrote: >>> hi all >>> >>> >>> my database server is running on one machine and the application is >>> running on another machine(simple java application use to access the >>> database). >>> >>> so i want to know, what is the protocol that use to communicate >>> between those two applications...? >> >> JDBC. >> > > not exactly. JDBC is the API your app uses to access the database. > the JDBC class libraries for postgres on the client system will use > postgres's native protocol to talk to the PG Server (default of 5432/tcp) Well, with any network communication, there are multiple layers of protocols involved. You took it one layer below JDBC, but we could keep on going down to the physical layer link protocol. Since the O.P. was asking on a JDBC mailing list, I assumed he was interested in that layer. -- Guy Rouillier
Guy Rouillier wrote: > John R Pierce wrote: >> Guy Rouillier wrote: >>> janaka priyadarshana wrote: >>>> hi all >>>> >>>> >>>> my database server is running on one machine and the application >>>> is running on another machine(simple java application use to access >>>> the database). >>>> >>>> so i want to know, what is the protocol that use to communicate >>>> between those two applications...? >>> >>> JDBC. >>> >> >> not exactly. JDBC is the API your app uses to access the >> database. the JDBC class libraries for postgres on the client >> system will use postgres's native protocol to talk to the PG Server >> (default of 5432/tcp) > > Well, with any network communication, there are multiple layers of > protocols involved. You took it one layer below JDBC, but we could > keep on going down to the physical layer link protocol. Since the > O.P. was asking on a JDBC mailing list, I assumed he was interested in > that layer. > His first e-mail was asking for an example of how to do a connection pooling in Java using JDBC. I think he was trying to ask that same question and accidentally used the word 'protocol'. My guess is English is not his first language. Maybe someone could post a URL to some connection pooling examples and documentation? --James
Guy Rouillier wrote: > John R Pierce wrote: >> Guy Rouillier wrote: >>> janaka priyadarshana wrote: >>>> hi all >>>> >>>> >>>> my database server is running on one machine and the application >>>> is running on another machine(simple java application use to access >>>> the database). >>>> >>>> so i want to know, what is the protocol that use to communicate >>>> between those two applications...? >>> >>> JDBC. >>> >> >> not exactly. JDBC is the API your app uses to access the >> database. the JDBC class libraries for postgres on the client >> system will use postgres's native protocol to talk to the PG Server >> (default of 5432/tcp) > > Well, with any network communication, there are multiple layers of > protocols involved. You took it one layer below JDBC, but we could > keep on going down to the physical layer link protocol. Since the > O.P. was asking on a JDBC mailing list, I assumed he was interested in > that layer. > Note the difference between the Protocol and the API. Correct answer, IMHO, would be that PostgreSQL JDBC driver is Type 4 and it will use same protocol as native client. To be noted, that is does not contain Type 2 driver and so can communicate via TCP/IP only, even when connecting to local host. Also there is an option to use SSL secured connection, but I can't tell any more (how to enable this) because've never used this mode. There may be some Java-specific SSL problems (like specifying keyring).