Home > Database > Mysql Tutorial > body text

java-mysql中getConnection();得到的Connection 怪怪的。

WBOY
Release: 2016-06-06 09:39:36
Original
1082 people have browsed it

mysqljava

图片说明
这个是返回我的Connection连接对象。
图片说明
我若直接在public static Connection getConnection() 所在类。main方法,以及
在public void add(User user) {所在类 main方法直接调用test(),,每次运行老是给我返回com.mysql.jdbc.JDBC4Connection@446cdf90同一个对象。。
而若间接着好多个类调用先调用new LoginFrame();——》new UserDAOJDBCImpl().test();则给我随机的些Connection对象。。好难理解哦哦。。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!