In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Option 1:
Statement.executeUpdate ("sql", Statement.RETURN_GENERATED_KEYS)
Resultset = statement.getGeneratedKeys ()
If (resultset! = null & & resultset.next ()) {
Generatedkey = resultset.getLong (1); / / returns the inserted primary key id
Option 2:
Insert into test (test_name) values ('111')
Select last_insert_id ()
The two schemes need to be tested and have not yet been tested.
(test results on 2006-07-06:
The former scheme is more general, but needs jdbc3.0 support.
The latter scheme: only for mysql
The latter scheme sqlserver uses select @ @ identity
)
Http://kb.csdn.net/java/Articles/200605/485033bf-2d4c-4cea-9f79-fc714f02ab90.html
Attached:
A brief discussion on the method of inserting records with self-increasing primary key in master and child table INT
Http://www.knowsky.com/301344.html
[@ more@]
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.