In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces what is the operation procedure of jdbc access database class, the content is very detailed, interested friends can refer to, hope to be helpful to you.
/ * work ahead of time
String driver= "com.micsoft.sqlserver.jdbc.sqlserverDriver"; / / Database Link driver
String url= "jdbc:sqlserver://localhost:1433;databasename= Library name"; / / Database link path
PrepareStatement ps=null;// defines variables for precompiled statements
Connection con=null;// defines database link variables
ResultSet res=null;// defines query result set variables
/ * steps in the query method
1. Load driver
Class.forName (drive path)
2. Get the link (obtained through the driver manager)
DriverManager.getConnection (Database address, Database user name, Database password)
2. Precompile the sql statement (through the database link obtained)
Con.prepareStatement ("incoming sql statement")
3. Determine whether the incoming array is empty, or assign values to precompiled statements by convenience (assignment of precompiled statements starts with subscript 1)
Ps.setObject (iMag1) obj.
4. Execute the query statement to get the result set
Res=ps.executeQuery ()
5. It is convenient for the result set to get each row of data and put it into the map collection. Finally, the map collection is put into the arrayList collection and returned.
While (res.next ()) {/ / read line by line
Map map=new HashMap (); / / every row of data is put into map
For (int iTuno Bandi)
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.