Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 几种常用数据库的JDBC连接方式
jameszhang



CJSDN高级会员


发贴: 1594
积分: 111
于 2003-08-13 11:28 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
连接Oracle8/8i/9i数据库(用thin模式)

Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
String url="jdbc:oracle:thin:@localhost:1521:orcl";

-------------------------------------------------------------------
连接Sql Server7.0/2000数据库

Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft: sqlserver://localhost:1433;DatabaseName=pubs";

-------------------------------------------------------------------
连接DB2数据库
Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance();
String url="jdbc: db2://localhost:5000/sample";
-------------------------------------------------------------------
连接Informix数据库
Class.forName("com.informix.jdbc.IfxDriver").newInstance();
String url ="jdbc:informix- sqli://123.45.67.89:1533/testDB:INFORMIXSERVER=myserver";
-------------------------------------------------------------------
连接Sybase数据库

Class.forName("com.sybase.jdbc.SybDriver").newInstance();
String url =" jdbc:sybase:Tds:localhost:5007/tsdata";

-------------------------------------------------------------------
连接MySQL数据库

Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc: mysql://localhost/softforum" ;
-------------------------------------------------------------------
连接PostgreSQL数据库
Class.forName("org.postgresql.Driver").newInstance();
String url ="jdbc: postgresql://localhost/soft" ;

-------------------------------------------------------------------


why edited on 2003-08-13 15:04

"First they ignore u, then they laugh at u, then they fight u, then u will win

Mahatma Gandhi"


话题树型展开
人气 标题 作者 字数 发贴时间
7129 几种常用数据库的JDBC连接方式 jameszhang 1513 2003-08-13 11:28
5443 Re:几种常用数据库的JDBC连接方式 truexie 249 2003-08-14 09:19
5543 Re:几种常用数据库的JDBC连接方式 why 215 2003-10-27 11:15
5758 Re:几种常用数据库的JDBC连接方式 jameszhang 89 2003-08-14 13:54
5493 Re:几种常用数据库的JDBC连接方式 nothing 497 2003-10-27 10:48

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923