您现在的位置是:首页 >

数据库连接类型 数据库连接基本方式探讨

火烧 2021-12-19 23:05:05 1053
数据库连接基本方式探讨   MySQL  Stri g Driver= my ql jd c Driver //驱动程序  Stri g URL= jd c:my ql://localho t: /d

数据库连接基本方式探讨  

  MySQL

  String Driver= mysql jdbc Driver ;    //驱动程序

  String URL= jdbc:mysql://localhost: /db_name ;    //连接的URL db_name为数据库名

  String Username= username ;    //用户名

  String Password= password ;    //密码

  Class forName(Driver) new Instance();

  Connection con=DriverManager getConnection(URL Username Password);

  Microsoft SQL Server 驱动( 个jar的那个):

  String Driver= microsoft jdbc sqlserver SQLServerDriver ;    //连接SQL数据库的方法

  String URL= jdbc:microsoft:sqlserver://localhost: ;DatabaseName=db_name ;    //db_name为数据库名

  String Username= username ;    //用户名

  String Password= password ;    //密码

  Class forName(Driver) new Instance();    //加载数据可驱动

  Connection con=DriverManager getConnection(URL UserName Password);    //

  Microsoft SQL Server 驱动( 个jar的那个): // 老紫竹完善

  String Driver= microsoft sqlserver jdbc SQLServerDriver ;    //连接SQL数据库的方法

  String URL= jdbc:microsoft:sqlserver://localhost: ;DatabaseName=db_name ;    //db_name为数据库名

  String Username= username ;    //用户名

  String Password= password ;    //密码

  Class forName(Driver) new Instance();    //加载数据可驱动

  Connection con=DriverManager getConnection(URL UserName Password);    //

  Sysbase:

  String Driver= sybase jdbc SybDriver ;    //驱动程序

  String URL= jdbc:Sysbase://localhost: /db_name ;    //db_name为数据可名

  String Username= username ;    //用户名

  String Password= password ;    //密码

  Class forName(Driver) newInstance();

  Connection con=DriverManager getConnection(URL Username Password);

  Oracle(用thin模式):

  String Driver= oracle jdbc driver OracleDriver ;    //连接数据库的方法

  String URL= jdbc:oracle:thin:@loaclhost: :orcl ;    //orcl为数据库的SID

  String Username= username ;    //用户名

  String Password= password ;    //密码

  Class forName(Driver) newInstance();    //加载数据库驱动

  Connection con=DriverManager getConnection(URL Username Password);

  PostgreSQL:

  String Driver= postgresql Driver ;    //连接数据库的方法

  String URL= jdbc:postgresql://localhost/db_name ;    //db_name为数据可名

  String Username= username ;    //用户名

  String Password= password ;    //密码

  Class forName(Driver) newInstance();

  Connection con=DriverManager getConnection(URL Username Password);

  DB

  String Driver= ibm db jdbc app DB Driver ;    //连接具有DB 客户端的Provider实例

  //String Driver= DB Driver ;    //连接不具有DB 客户端的Provider实例

  String URL= jdbc:db ://localhost: /db_name ;    //db_name为数据可名

数据库连接类型 数据库连接基本方式探讨

  String Username= username ;    //用户名

  String Password= password ;    //密码

  Class forName(Driver) newInstance();

  Connection con=DriverManager getConnection(URL Username Password);

  Informix:

  String Driver= rmix jdbc IfxDriver ;

  String URL= jdbc:Informix sqli://localhost: /db_name:INFORMIXSER=myserver ;    //db_name为数据可名

  String Username= username ;    //用户名

  String Password= password ;    //密码

  Class forName(Driver) newInstance();

  Connection con=DriverManager getConnection(URL Username Password);

  JDBC ODBC:

  String Driver= sun jdbc odbc JdbcOdbcDriver ;

  String URL= jdbc:odbc:dbsource ;    //dbsource为数据源名

  String Username= username ;    //用户名

  String Password= password ;    //密码

  Class forName(Driver) newInstance();

lishixinzhi/Article/program/Java/hx/201311/26062  
永远跟党走
  • 如果你觉得本站很棒,可以通过扫码支付打赏哦!

    • 微信收款码
    • 支付宝收款码