zoukankan      html  css  js  c++  java
  • 4、原生jdbc链接数据库常用资源名

    原生jdbc链接数据库要素:
    #MySql:
    String url="jdbc:mysql://localhost:3306/数据库名";
    String name="root"; //数据库用户名
    String password="123456"; //数据库用户密码
    Class.forName("com.mysql.jdbc.Driver") ; //加载MySQL驱动
    Connection conn = DriverManager.getConnection(url,name,password); //连接数据库

    #Oracle:
    String url="jdbc:oracle:thin:@localhost:1521:数据库名";
    String name="数据库用户名"; //数据库用户名
    String password="数据库用户密码"; //数据库用户密码
    Class.forName("oracle.jdbc.driver.OracleDriver"); //加载oracle驱动
    Connection conn = DriverManager.getConnection(url,name,password); //连接数据库

    #SqlServer:
    String url="jdbc:sqlserver://localhost:1433;DatabaseName=数据库名"; //数据库地址
    Sring name="数据库用户名"; //数据库用户名
    String password="数据库用户密码"; //数据库用户密码
    Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); //加载Sql Server驱动
    Connection conn = DriverManager.getConnection(url,name,password); //连接数据库

    Spring Boot项目链接数据库要素:
    #MySql:
    spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
    spring.datasource.driverClassName=com.mysql.jdbc.Driver
    spring.datasource.url=jdbc:mysql://192.168.1.1:3306/hserp?characterEncoding=utf-8&allowMultiQueries=true
    spring.datasource.username=root
    spring.datasource.password=root

    #H2
    spring.datasource.driver-class-name=org.h2.Driver
    spring.datasource.url=jdbc:h2:~/test;AUTO_SERVER=TRUE
    spring.datasource.username=sa
    spring.datasource.password=
    spring.jpa.show-sql=true

  • 相关阅读:
    NOI 模拟赛
    bzoj 4998 星球联盟
    bzoj 4545 DQS 的 Trie
    loj #161 子集卷积
    bzoj 5093 图的价值
    bzoj 4299 Codechef FRBSUM
    NOI 模拟赛
    WC2018 州区划分
    CSP 2020 T2 动物园
    CSP 2020 T1 儒略日
  • 原文地址:https://www.cnblogs.com/wlxslsb/p/10722586.html
Copyright © 2011-2022 走看看