In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 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.
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.