Tags: paging page page JSP paging page How to do MySQL pagingWhy do you want to page out data? When the data is more, the page will become very large, not only affect the user's use, but also the burden of aggravating the server. The following is a simple implementation of the data paging.First step: Import the appropriate jar packageYou need to import jar packages such as c3p0,dbutils,mysql drivers.Step two: Create a database and table, configure
= "true" /> Auto-Reclaim time-out (in seconds) - Propertyname= "Removeabandonedtimeout"value= "$"/> set the time-out error for printing a connection when the auto-recycle time-out connection - Propertyname= "logabandoned"value= "true"/> The wait time-out in milliseconds, before the exception is thrown, the maximum time the pool waits for the connection to be reclaimed (when no connection is available). Set to 1 to indicate an infinite wait. - P
Tags: AOS driver Bubuko framework classname configuration picture Alt CatFirst, preface:Both DBCP and C3PO can be used as data connection pools,Second, import jar package:Third, configuration Applicationcontext.xml fileConfigure DBCP Create a data source -
BeanID= "DataSourceId"class= "Org.apache.commons.dbcp.BasicDataSource">
Propertyname= "Driverclassname"value= "Com.mysql.jdbc.Driver"> Property>
Propertyname= "url"value= "Jdbc:mysql://localhost:3306/ee19_spring_day02"> P
Tags: style blog color os using IO for AR dataAbout C3P0, DBCP and Proxool, such as the comparison, configuration on the internet has a lot of articles, I do not waste everyone's time, mainly on the following I have used these three after the experience.
DBCP: The framework used to be dbcp, Online said, there are many bugs, at least, these bugs, I have not encountered, from the situation of our system operation, can also, there is not too muc
-------------------- * Hibernate. cfg. xml ----------------------------------
"-// Hibernate/hibernate configuration DTD 3.0 // en"Http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd>Org. hibernate. Connection. c3p0connectionprovider
----------------------------- Ehcache. xml ---------------------------------------------------
If the path is a Java System property it is replacedIts value in the running VM.
The following properties are
pack-The Oracle database is used here and we will import the Ojdbc6.jar jdbc.properties configuration file-url=jdbc:oracle:thin: @localhost: 1521:ORCLUser=lghPassword=lghClassname=oracle.jdbc.oracledriverWriting the database Connection tool class
Package com.jt.demo07;
Import java.io.IOException;
Import java.sql.Connection;
Import Java.sql.DriverManager;
Import Java.sql.ResultSet;
Import java.sql.SQLException;
Import java.sql.Statement;
Import java.util.Properties;
/** * Database Connection
Original address:
The difference between C3P0 and DBCP
https://blog.csdn.net/huangxinyu_it/article/details/50826463
C3P0 Introduction:C3P0 is an open-source JDBC connection pool that implements data source and Jndi bindings, and supports standard extensions for JDBC3 specifications and JDBC2. The open source project that uses it now has hibernate,spring etc.DBCP Introduction:DBCP (db connection pool),
This is an example I have seen on the internet before, I think c3p0 more mature, stable, in the general project to choose C3P0 to do database connection pool is better, so I posted in the Applicationcontext.xml file to configure an example of C3P0, for reference.
A new frame to do junit test times out of the following error.
Java.lang.Exception:DEBUG STACK TRACE for Poolbackeddatasource.close (). At Com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.close (abstractpoolbackeddatasource.java:417) at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native method) at Sun.reflect.NativeMethodAccessorImpl.invoke ( nativemethodaccessorimpl.java:39) at Sun.reflect.DelegatingMethodAccessorImpl.invoke ( DELEGATINGMETH
Today in doing a Java project to use the C3P0 data source, the program runs under Windows without any problems, but to the server (Linux environment) when the deployment of the runtime abnormal, the exception information is as follows:
2014-08-19 20:51:01 [INFO] Failed to get local inetaddress for VMID. This is unlikely to matter. At all.
We ll add some extra randomness java.net.unknownhostexception:w: W at Java.net.InetAddress.getLocalHost (Unknow
Although DBCP is a widely used connection pool, I think that C3P0 has higher performance and stability on Tomcat. Here's how to use C3P0 in spring:
class= "Org.springframework.orm.hibernate3.LocalSessionFactoryBean" >Org.hibernate.dialect.Oracle9Dialect
Bind the Connection object to the current thread so that the link can be used in each method.Datasourceutils.javaPackage Com.itheima.utils;import Java.sql.connection;import Java.sql.resultset;import java.sql.SQLException;import Java.sql.statement;import Javax.sql.datasource;import Com.mchange.v2.c3p0.combopooleddatasource;public Class datasourceutils {private static Combopooleddatasource ds=new Combopooleddatasource ();p rivate static threadlocaljava-
DBCP Connection Pool configuration
About DBCP Connection pool The specific use of the method also need to refer to: Click to open the link dbcp jar package
Commons-dbpc.jar, Commons-collections.jar, commons-pool.jar download click to downloadc3p0 Connection Pool configuration
For more information on C3P0 connection pooling use: Click to open linkc3p0 jar Package
C3p0-0.9.2.jar Download Click to down
--------------------------------------------------------------------------------------------------------------- ----------------------------Import Com.mchange.v2.c3p0.ComboPooledDataSource;Combopooleddatasource pool=new Combopooleddatasource ();System.out.println (Pool.getproperties ());//the user name and password of MySQL can be exported here;for (int i=0;iConnection con=pool.getconnection ();System.out.println (Con.hashcode ());//This is the addres
are available. The configuration of this connection pool is described in the attachment compression package: Dbcp.xmlUsage Evaluation: In the specific project application, it is found that the stability of the continuous operation of this connection pool is still possible, but the speed is slightly slower, the stability under the pressure of the large concurrent quantityThe connection pool monitoring is also not available2 C3P0C3P0 is another open source connection pool, in the industry is also
Package Com.itheima.c_c3p0;import Java.sql.connection;import Java.sql.sqlexception;import Javax.sql.DataSource; Import Com.mchange.v2.c3p0.combopooleddatasource;public class C3p0utils {//provide connection pool private static DataSource DataSource = New Combopooleddatasource ("Day17_config"); public static Connection getconnection () throws sqlexception{//the return datasource.getconnection () obtained from the connection pool; /** * Data source, Con
//property Definition of a classclassStudent:nsobject {//Defining Properties//Defining Storage Propertiesvar age:int =0var name:string?var mathscore:double=0.0var chinesescore:D ouble=0.0 //define a method that can be a return on average score (note: Swift is not recommended for this use, a computed attribute should be defined)Func Getaveragescore ()Double {//in Swift If you are using one of the properties
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.