JDBC操作数据库——CRUD综合应用实例

本文涉及的产品
云数据库 RDS MySQL Serverless,0.5-2RCU 50GB
简介:

通过一个综合型的例子加深对JDBC操作数据库的增、删、改、查的运用。

经典的图书信息录入实例


设计数据库

1
2
3
4
5
6
7
8
9
10
11
12
13
14
CREATE  TABLE  `tb_books`
(
   `id`  int (10) unsigned  NOT  NULL  AUTO_INCREMENT,
    
  ` name varchar (45)  NOT  NULL ,
    
  `price`  double  NOT  NULL ,
    
  `bookCount`  int (10) unsigned  NOT  NULL ,
    
  `author`  varchar (45)  NOT  NULL ,
    
  PRIMARY  KEY  (`id`)
)


wKioL1Lc1R6gdL0NAAHwzIdUb9A861.jpg


写一个Book类对图书信息进行封装

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package  com.lixiyu;
public  class  Book {
private  int  id;
private  String name;
private  double  price;
private  int  bookCount;
private  String author;
public  int  getId(){
     return  id;
}
public  void  setId( int  id){
     this .id=id;
}
public  String getName(){
     return   name;
}
public  void  setName(String name){
     this .name=name;
}
public  double  getPrice(){
     return  price;
}
public  void  setPrice( double  price){
     this .price=price;
}
public  int  getbookCount(){
     return  bookCount;
}
public  void  setbookCount( int  bookCount){
     this .bookCount=bookCount;
}
public  String getAuthor(){
     return  author;
}
public  void  setAuthor(String author){
     this .author=author;
}
}





添加(insert)图书信息操作


创建AddBook.jsp页面,用于对添加图书信息进行处理

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<%@ page language="java" contentType="text/html; charset=GB18030"
     pageEncoding="GB18030"%>
     <%@page import="java.sql.Connection"%>
<%@page import="java.sql.DriverManager"%>
<%@page import="java.sql.PreparedStatement"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
< html >
< head >
< meta  http-equiv = "Content-Type"  content = "text/html; charset=GB18030" >
< title >Insert title here</ title >
</ head >
< body >
<%request.setCharacterEncoding("UTF-8"); %>
< jsp:useBean  id = "book"  class = "com.lixiyu.Book" ></ jsp:useBean >
< jsp:setProperty  property = "*"  name = "book" />
<%
try{
     Class.forName("com.mysql.jdbc.Driver");//加载数据库驱动,注册到驱动管理器
     String url="jdbc:mysql://localhost:3306/db_test";//数据库连接字符串
     String username="root";//数据库用户名
     String password="lixiyu";//数据库密码
     Connection conn=DriverManager.getConnection(url,username,password);//创建Connection连接
     String sql="insert into tb_books(name,price,bookCount,author)values(?,?,?,?)";//添加图书信息sql语句
                                                                                                                                                                                                                                                                                                                                                                                                                        
     PreparedStatement ps=conn.prepareStatement(sql);//获取PreparedStatement
     ps.setString(1,book.getName());//对SQL语句中的第1个参数赋值
     ps.setDouble(2,book.getPrice());
     ps.setInt(3,book.getbookCount());
     ps.setString(4,book.getAuthor());//对SQL语句中的第4个参数赋值
     int row=ps.executeUpdate();//执行更新操作,返回所影响的行数
     if(row>0){
         out.print("成功添加了"+row+"条数据");
     }
     ps.close();
     conn.close();
}catch(Exception e){
     out.print("图书信息添加失败!");
     e.printStackTrace();
}
%>
</ body >
< a  href = "insert.jsp" >返回</ a >
</ html >


创建insert.jsp,用于创建添加图书信息所需的表单

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<%@ page language="java" contentType="text/html; charset=UTF-8"
     pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
< html >
< head >
< meta  http-equiv = "Content-Type"  content = "text/html; charset=UTF-8" >
< title >添加图书信息</ title >
< script  type = "text/javascript" >
     function check(form){
         with(form){
             if(name.value == ""){
                 alert("图书名称不能为空");
                 return false;
             }
             if(price.value == ""){
                 alert("价格不能为空");
                 return false;
             }
             if(author.value == ""){
                 alert("作者不能为空");
                 return false;
             }
             return true;
         }
     }
</ script >
</ head >
< body >
     < form  action = "AddBook.jsp"  method = "post"  onsubmit = "return check(this);" >
         < table  align = "center"  width = "450" >
             < tr >
                 < td  align = "center"  colspan = "2" >
                     < h2 >添加图书信息</ h2 >
                     < hr >
                 </ td >
             </ tr >
             < tr >
                 < td  align = "right" >图书名称:</ td >
                 < td >< input  type = "text"  name = "name"  /></ td >
             </ tr >
             < tr >
                 < td  align = "right" >价  格:</ td >
                 < td >< input  type = "text"  name = "price"  /></ td >
             </ tr >
             < tr >
                 < td  align = "right" >数  量:</ td >
                 < td >< input  type = "text"  name = "bookCount"  /></ td >
             </ tr >
             < tr >
                 < td  align = "right" >作  者:</ td >
                 < td >< input  type = "text"  name = "author"  /></ td >
             </ tr >
             < tr >
                 < td  align = "center"  colspan = "2" >
                     < input  type = "submit"  value = "添 加" >
                 </ td >
             </ tr >
         </ table >
     </ form >
</ body >
</ html >

最后运行

wKioL1Lc2WaiySd8AABt3y2sBH4326.jpg

成功:

wKiom1Lc2Yui_pabAABF1HO1eQA506.jpg



查询(select)图书信息操作


创建FindServlet的servlet对象用于查询所有图书的信息。编写doGet()方法,建立数据库连接,并将所有查询数据集合放置HttpServletRequest对象中,将请求转发到jsp页面中:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package  com.lixiyu;
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.ArrayList;
import  java.util.List;
import  javax.servlet.ServletException;
import  javax.servlet.annotation.WebServlet;
import  javax.servlet.http.HttpServlet;
import  javax.servlet.http.HttpServletRequest;
import  javax.servlet.http.HttpServletResponse;
/**
  * Servlet implementation class FindServlet
  */
public  class  FindServlet  extends  HttpServlet {
     private  static  final  long  serialVersionUID = 1L;
                                                                                                                                                                                                                                                                                                                   
     /**
      * @see HttpServlet#HttpServlet()
      */
     public  FindServlet() {
         super ();
         // TODO Auto-generated constructor stub
     }
     /**
      * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
      */
     protected  void  doGet(HttpServletRequest request, HttpServletResponse response)  throws  ServletException, IOException {
         // TODO Auto-generated method stub
         try {
             Class.forName( "com.mysql.jdbc.Driver" );
             String url= "jdbc:mysql://localhost:3306/db_test" ;
             String username= "root" ;
             String password= "lixiyu" ;
             Connection conn=DriverManager.getConnection(url,username,password);
             Statement stmt=conn.createStatement(); //获取statement对象
             String sql= "select * from tb_books" ;
             ResultSet rs=stmt.executeQuery(sql);
             List<Book> list= new  ArrayList<Book>(); //实例化list对象
             while (rs.next()){
                 Book book= new  Book();
                 book.setId(rs.getInt( "id" )); //对id属性赋值
                 book.setName(rs.getString( "name" ));
                 book.setPrice(rs.getDouble( "price" ));
                 book.setbookCount(rs.getInt( "bookCount" ));
                 book.setAuthor(rs.getString( "author" ));
             list.add(book); //将图书对象添加到集合中
             }
             request.setAttribute( "list" , list); //将图书集合放置到request中
             rs.close(); //关闭ResultSet
             stmt.close(); //关闭Statement
             conn.close(); //关闭Connection
         } catch (ClassNotFoundException e){
             e.printStackTrace();
         } catch (SQLException e){
             e.printStackTrace();
         }
         request.getRequestDispatcher( "book_list.jsp" ).forward(request, response); //请求转发到book_List.jsp
     }
     /**
      * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
      */
     protected  void  doPost(HttpServletRequest request, HttpServletResponse response)  throws  ServletException, IOException {
         // TODO Auto-generated method stub
     }
}


在web.xml中添加映射:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
< welcome-file-list >
    < welcome-file >index.html</ welcome-file >
    < welcome-file >index.htm</ welcome-file >
    < welcome-file >index.jsp</ welcome-file >
    < welcome-file >default.html</ welcome-file >
    < welcome-file >default.htm</ welcome-file >
    < welcome-file >default.jsp</ welcome-file >
  </ welcome-file-list >
  < servlet >
    < description ></ description >
    < display-name >FindServlet</ display-name >
    < servlet-name >FindServlet</ servlet-name >
    < servlet-class >com.lixiyu.FindServlet</ servlet-class >
  </ servlet >
  < servlet-mapping >
    < servlet-name >FindServlet</ servlet-name >
    < url-pattern >/FindServlet</ url-pattern >
  </ servlet-mapping >


创建book_list.jsp页面,用于显示查询到的所有图书信息

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<%@ page language="java" contentType="text/html; charset=UTF-8"
     pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.List"%>
<%@page import="com.lixiyu.Book"%>
< html >
< head >
< meta  http-equiv = "Content-Type"  content = "text/html; charset=UTF-8" >
< title >所有图书信息</ title >
< style  type = "text/css" >
     td{font-size: 12px;}
     h2{margin: 0px}
                                                                                                                                                                                                                                                                                                  
</ style >
</ head >
< body >
     < table  align = "center"  width = "450"  border = "1"  height = "180"  bordercolor = "white"  bgcolor = ""  cellpadding = "1"  cellspacing = "1" >
         < tr  bgcolor = "white" >
             < td  align = "center"  colspan = "5" >
                 < h2 >所有图书信息</ h2 >
             </ td >
         </ tr >
         < tr  align = "center"  bgcolor = "#e1ffc1"  >
             <!--  <td><b>ID</b></td>-->
             < td >< b >图书名称</ b ></ td >
             < td >< b >价格</ b ></ td >
             < td >< b >数量</ b ></ td >
             < td >< b >作者</ b ></ td >
         </ tr >
             <%
                 // 获取图书信息集合
                     List< Book >list = (List< Book >)request.getAttribute("list");
                     // 判断集合是否有效
                     if(list == null || list.size() <  1 ){
                         out.print("没有数据!");
                     }else{
                         // 遍历图书集合中的数据
                         for(Book book : list){
             %>
                 < tr  align = "center"  bgcolor = "white" >
                     <!--<td><%=book.getId()%></td>-->
                     < td ><%=book.getName()%></ td >
                     < td ><%=book.getPrice()%></ td >
                     < td ><%=book.getbookCount()%></ td >
                     < td ><%=book.getAuthor()%></ td >
                 < td >
                 < form  action = "UpdateServlet"  method = "post"  onsubmit = "return check(this);" >
                 < input  type = "hidden"  name = "id"  value="<%=book.getId()%>">
                 < input  type = "text"  name = "bookCount"  size = "3" >
                                                                                                                                                                                                                                                                                                              
                 </ form >
                                                                                                                                                                                                                                                                                                              
                 </ tr >
                                                                                                                                                                                                                                                                                                              
             <%
                     }
                 }
             %>
     </ table >
     < br >
</ body >
</ html >


创建index.jsp主页,用于请求查看所有图书信息:

1
2
3
< body >
< a  href = "FindServlet" >查看所有图书</ a >
</ body >

运行该实例

wKioL1Lc3QTylxv_AABOjiFfdvU910.jpg

wKiom1Lc3SiR9yGMAACeYDmI6lY322.jpg



修改(update)图书信息操作


在book_list.jsp中添多一列修改:

1
2
3
4
5
6
< td >
                 < form  action = "UpdateServlet"  method = "post"  onsubmit = "return check(this);" >
                 < input  type = "hidden"  name = "id"  value="<%=book.getId()%>">
                 < input  type = "text"  name = "bookCount"  size = "3" >
                 < input  type = "submit"  value = "修改" >
                 </ form ></ td >


创建UpdateServlet.jsp编写doPost方法对图书信息请求进行处理:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package  com.lixiyu;
import  java.io.IOException;
import  java.sql.Connection;
import  java.sql.DriverManager;
import  java.sql.PreparedStatement;
import  javax.servlet.ServletException;
import  javax.servlet.http.HttpServlet;
import  javax.servlet.http.HttpServletRequest;
import  javax.servlet.http.HttpServletResponse;
/**
  * Servlet implementation class UpdateServlet
  */
public  class  UpdateServlet  extends  HttpServlet {
     private  static  final  long  serialVersionUID = 1L;
     protected  void  doPost(HttpServletRequest request, HttpServletResponse response)  throws  ServletException, IOException {
         int  id = Integer.valueOf(request.getParameter( "id" ));
         int  bookCount = Integer.valueOf(request.getParameter( "bookCount" ));
         try  {
             // 加载数据库驱动,注册到驱动管理器
             Class.forName( "com.mysql.jdbc.Driver" );
             // 数据库连接字符串
             String url =  "jdbc:mysql://localhost:3306/db_test" ;
             // 数据库用户名
             String username =  "root" ;
             // 数据库密码
             String password =  "lixiyu" ;
             // 创建Connection连接
             Connection conn = DriverManager.getConnection(url,username,password);
             // 更新SQL语句
             String sql =  "update tb_books set bookcount=? where id=?" ;
             // 获取PreparedStatement
             PreparedStatement ps = conn.prepareStatement(sql);
             // 对SQL语句中的第一个参数赋值
             ps.setInt( 1 , bookCount);
             // 对SQL语句中的第二个参数赋值
             ps.setInt( 2 , id);
             // 执行更新操作
             ps.executeUpdate();
             // 关闭PreparedStatement
             ps.close();
             // 关闭Connection
             conn.close();
         catch  (Exception e) {
             e.printStackTrace();
         }
         // 重定向到FindServlet
         response.sendRedirect( "FindServlet" );
     }
}

添加xml映射

1
2
3
4
5
6
7
8
9
< servlet >
     < display-name >UpdateServlet</ display-name >
     < servlet-name >UpdateServlet</ servlet-name >
     < servlet-class >com.lixiyu.UpdateServlet</ servlet-class >
   </ servlet >
   < servlet-mapping >
     < servlet-name >UpdateServlet</ servlet-name >
     < url-pattern >/UpdateServlet</ url-pattern >
   </ servlet-mapping >


运行后

wKiom1Lc4FfSbOO9AAD9RNsUFKY761.jpg

wKiom1Lc4GbCah6KAAEDugnF2Y4344.jpg



删除(delete)图书信息操作


编写删除操作的servlet,命名为DeleteServlet:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package  com.lixiyu;
import  java.io.IOException;
import  java.sql.Connection;
import  java.sql.DriverManager;
import  java.sql.PreparedStatement;
import  javax.servlet.ServletException;
import  javax.servlet.http.HttpServlet;
import  javax.servlet.http.HttpServletRequest;
import  javax.servlet.http.HttpServletResponse;
/**
  * Servlet implementation class DeleteServlet
  */
public  class  DeleteServlet  extends  HttpServlet {
     private  static  final  long  serialVersionUID = 1L;
                                                                                                                                          
     protected  void  doGet(HttpServletRequest request, HttpServletResponse response)  throws  ServletException, IOException {
         // 获取图书id
         int  id = Integer.valueOf(request.getParameter( "id" ));
         try  {
             // 加载数据库驱动,注册到驱动管理器
             Class.forName( "com.mysql.jdbc.Driver" );
             // 数据库连接字符串
             String url =  "jdbc:mysql://localhost:3306/db_test" ;
             // 数据库用户名
             String username =  "root" ;
             // 数据库密码
             String password =  "lixiyu" ;
             // 创建Connection连接
             Connection conn = DriverManager.getConnection(url,username,password);
             // 删除图书信息的SQL语句
             String sql =  "delete from tb_books where id=?" ;
             // 获取PreparedStatement
             PreparedStatement ps = conn.prepareStatement(sql);
             // 对SQL语句中的第一个占位符赋值
             ps.setInt( 1 , id);
             // 执行更新操作
             ps.executeUpdate();
             // 关闭PreparedStatement
             ps.close();
             // 关闭Connection
             conn.close();
         catch  (Exception e) {
             e.printStackTrace();
         }
         // 重定向到FindServlet
         response.sendRedirect( "FindServlet" );
     }
}

添加xml映射:

1
2
3
4
5
6
7
8
9
10
11
< servlet >
     < description ></ description >
     < display-name >DeleteServlet</ display-name >
     < servlet-name >DeleteServlet</ servlet-name >
     < servlet-class >com.lixiyu.DeleteServlet</ servlet-class >
   </ servlet >
   < servlet-mapping >
     < servlet-name >DeleteServlet</ servlet-name >
     < url-pattern >/DeleteServlet</ url-pattern >
   </ servlet-mapping >
</ web-app >


整合CRUD操作


在前面book_list.jsp页面中进行整合:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<%@ page language="java" contentType="text/html; charset=UTF-8"
     pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.List"%>
<%@page import="com.lixiyu.Book"%>
< html >
< head >
< meta  http-equiv = "Content-Type"  content = "text/html; charset=UTF-8" >
< title >所有图书信息</ title >
< style  type = "text/css" >
td{font-size: 12px;}
h2{margin: 0px}
</ style >
</ head >
< body >
< table  align = "center"  width = "450"  border = "1"  height = "180"  bordercolor = "white"  bgcolor = ""  cellpadding = "1"  cellspacing = "1" >
< tr  bgcolor = "white" >
< td  align = "center"  colspan = "5" >
< h2 >所有图书信息</ h2 >
</ td >
</ tr >
< tr  align = "center"  bgcolor = "#e1ffc1"  >
<!--  <td><b>ID</b></td>-->
< td >< b >图书名称</ b ></ td >
< td >< b >价格</ b ></ td >
< td >< b >数量</ b ></ td >
< td >< b >作者</ b ></ td >
< td >< b >修改数量</ b ></ td >
< td >< b >删 除</ b ></ td >
</ tr >
<%
// 获取图书信息集合
List< Book >list = (List< Book >)request.getAttribute("list");
// 判断集合是否有效
if(list == null || list.size() <  1 ){
out.print("没有数据!");
}else{
// 遍历图书集合中的数据
for(Book book : list){
%>
< tr  align = "center"  bgcolor = "white" >
<!--<td><%=book.getId()%></td>-->
< td ><%=book.getName()%></ td >
< td ><%=book.getPrice()%></ td >
< td ><%=book.getbookCount()%></ td >
< td ><%=book.getAuthor()%></ td >
< td >
< form  action = "UpdateServlet"  method = "post"  onsubmit = "return check(this);" >
< input  type = "hidden"  name = "id"  value="<%=book.getId()%>">
< input  type = "text"  name = "bookCount"  size = "3" >
< input  type = "submit"  value = "修改" >
</ form >
</ td >
< td >< a  href="DeleteServlet?id=<%=book.getId() %>">删除</ a >
</ td >
</ tr >
<%
}
}
%>
</ table >
< br >
< center >
< form    action = "insert.jsp"  method = "post"  onsubmit = "return check(this);" >
  < input  type = "submit"  name = ""  value = "添加数据"  >
</ form ></ center >
</ body >
</ html >


将前面AddBook.jsp中的页面链接进行修改

1
< a  href = "FindServlet" >返回</ a >


因此整个操作都回归到book_list.jsp来显示了

运行

wKioL1Lc4ziS8nEnAABdTGVs-EI747.jpg

CRUD操作整合到一个页面显示:

wKiom1Lc416S0m57AAFWtV79j3M565.jpg



这次JDBC先写到这,下次有时间再总结一下批处理、调用存储过程、分页查询的相关操作。



本文转自lixiyu 51CTO博客,原文链接:http://blog.51cto.com/lixiyu/1353185,如需转载请自行联系原作者


相关实践学习
基于CentOS快速搭建LAMP环境
本教程介绍如何搭建LAMP环境,其中LAMP分别代表Linux、Apache、MySQL和PHP。
全面了解阿里云能为你做什么
阿里云在全球各地部署高效节能的绿色数据中心,利用清洁计算为万物互联的新世界提供源源不断的能源动力,目前开服的区域包括中国(华北、华东、华南、香港)、新加坡、美国(美东、美西)、欧洲、中东、澳大利亚、日本。目前阿里云的产品涵盖弹性计算、数据库、存储与CDN、分析与搜索、云通信、网络、管理与监控、应用服务、互联网中间件、移动服务、视频服务等。通过本课程,来了解阿里云能够为你的业务带来哪些帮助 &nbsp; &nbsp; 相关的阿里云产品:云服务器ECS 云服务器 ECS(Elastic Compute Service)是一种弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率,使您更专注于核心业务创新。产品详情: https://www.aliyun.com/product/ecs
相关文章
|
JavaScript 关系型数据库 MySQL
❤Nodejs 第六章(操作本地数据库前置知识优化)
【4月更文挑战第6天】本文介绍了Node.js操作本地数据库的前置配置和优化,包括处理接口跨域的CORS中间件,以及解析请求数据的body-parser、cookie-parser和multer。还讲解了与MySQL数据库交互的两种方式:`createPool`(适用于高并发,通过连接池管理连接)和`createConnection`(适用于低负载)。
19 0
|
15天前
|
存储 安全 搜索推荐
酒店管理系统的数据库的应用以及选择
酒店管理系统数据库关乎运营效率和服务质量。数据库用于数据存储、管理、分析及客户关系管理,确保房态与预订精准。选择时重视性能稳定性、数据安全、易用性、可扩展性和成本效益。合适的数据库能提升酒店运营效率并优化客户体验。
21 2
|
1月前
|
SQL 数据库连接 数据库
你不知道ADo.Net中操作数据库的步骤【超详细整理】
你不知道ADo.Net中操作数据库的步骤【超详细整理】
16 0
|
1天前
|
SQL druid Java
JDBC&数据库连接池
JDBC&数据库连接池
|
2天前
|
SQL Java 数据库连接
Java从入门到精通:2.3.1数据库编程——学习JDBC技术,掌握Java与数据库的交互
ava从入门到精通:2.3.1数据库编程——学习JDBC技术,掌握Java与数据库的交互
|
3天前
|
关系型数据库 MySQL 数据库
一台MySQL数据库启动多个实例
一台MySQL数据库启动多个实例
|
3天前
|
存储 SQL 数据库
数据库库表结构设计:原理、实例与最佳实践
数据库库表结构设计:原理、实例与最佳实践
18 0
|
9天前
|
存储 数据库连接 数据处理
NumPy与数据库的结合应用探索
【4月更文挑战第17天】本文探讨了NumPy与数据库结合在数据处理和分析中的应用,阐述了结合使用的必要性,包括数据提取、转换、处理与分析及结果存储。通过Python数据库连接库提取数据,转化为NumPy数组进行高效计算,适用于金融等领域的数据分析。结合应用的优势在于高效性、灵活性和可扩展性,但也面临数据转换、性能优化和安全性挑战。
|
17天前
|
存储 传感器 监控
数据库的应用
数据库广泛应用于电子商务、物流、酒店管理、医疗、航空、教育、政府和物联网等领域,用于高效存储和管理商品信息、订单数据、医疗记录、航班详情等各类数据,提升效率和服务质量。随着技术进步,其应用场景将持续扩展。
12 1
|
17天前
|
存储 关系型数据库 MySQL
【mybatis-plus】Springboot+AOP+自定义注解实现多数据源操作(数据源信息存在数据库)
【mybatis-plus】Springboot+AOP+自定义注解实现多数据源操作(数据源信息存在数据库)

热门文章

最新文章