惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Docker
AI
AI
博客园 - 三生石上(FineUI控件)
腾讯CDC
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
H
Hackread – Cybersecurity News, Data Breaches, AI and More
雷峰网
雷峰网
NISL@THU
NISL@THU
S
Schneier on Security
T
Threatpost
T
Tenable Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
IT之家
IT之家
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
C
Cybersecurity and Infrastructure Security Agency CISA
P
Privacy & Cybersecurity Law Blog
I
Intezer
Microsoft Azure Blog
Microsoft Azure Blog
月光博客
月光博客
T
Threat Research - Cisco Blogs
SecWiki News
SecWiki News
AWS News Blog
AWS News Blog
博客园 - Franky
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
P
Proofpoint News Feed
V
V2EX
Recorded Future
Recorded Future
Microsoft Security Blog
Microsoft Security Blog
S
Secure Thoughts
Google DeepMind News
Google DeepMind News
MongoDB | Blog
MongoDB | Blog
Apple Machine Learning Research
Apple Machine Learning Research
Project Zero
Project Zero
PCI Perspectives
PCI Perspectives
G
GRAHAM CLULEY
Help Net Security
Help Net Security
Cloudbric
Cloudbric
Recent Announcements
Recent Announcements
V
Visual Studio Blog
Hacker News: Ask HN
Hacker News: Ask HN
N
News and Events Feed by Topic
C
CERT Recently Published Vulnerability Notes
The Cloudflare Blog
Forbes - Security
Forbes - Security
C
Cisco Blogs
O
OpenAI News
www.infosecurity-magazine.com
www.infosecurity-magazine.com

博客园 - Jimmyzhang

每个孩子都是一朵独一无二的风信子(轉載,不知何處) MINA2官方教程翻译 2.x与1.x的变化 你应该辞职去创业吗?(轉載) Windows 2003上Oracle用花生壳工具通过公网连接步骤. 职场成功最重要的53句箴言(轉) 毕业后的五年拉开大家差距的原因在哪里(轉) - Jimmyzhang - 博客园 优秀的孩子是这样培养的 有感于国际米兰拿到欧冠后其主教练穆里尼奥执教态度 传说:十个看完,九个有领悟 (轉載) 英语新闻网站大全(转载) 圖片縮放及改變資料庫中的容量(BLOB),降低品質等專案代碼. 少有人走的路 人生最大的敌人是自已 小议改变 不对称创新 讀后感 轉載-----中专毕业后我的七年(励志篇,年轻人必看) sql server 數據字典(轉載) 即將來臨的經濟崩潰 写网站策划书应知道的十九个理论-----引用
Java连接各种数据库的实例 - Jimmyzhang - 博客园
Jimmyzhang · 2010-03-05 · via 博客园 - Jimmyzhang

1、Oracle8/8i/9i数据库(thin模式)

  Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();

  String url="jdbc:oracle:thin:@localhost:1521:orcl";

  //orcl为数据库的SID

  String user="test";

  String password="test";

  Connection conn= DriverManager.getConnection(url,user,password);

2、DB2数据库

  Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance();

  String url="jdbc:db2://localhost:5000/sample";

  //sample为你的数据库名

  String user="admin";

  String password="";

  Connection conn= DriverManager.getConnection(url,user,password);

3、Sql Server7.0/2000数据库

  Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();

  String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydb";

  //mydb为数据库

  String user="sa";

  String password="";

  Connection conn= DriverManager.getConnection(url,user,password);

4、Sybase数据库

  Class.forName("com.sybase.jdbc.SybDriver").newInstance();

  String url =" jdbc:sybase:Tds:localhost:5007/myDB";

  //myDB为你的数据库名

  Properties sysProps = System.getProperties();

  SysProps.put("user","userid");

  SysProps.put("password","user_password");

  Connection conn= DriverManager.getConnection(url, SysProps);

5、Informix数据库

  Class.forName("com.informix.jdbc.IfxDriver").newInstance();

  String url =

  "jdbc:informix-sqli://123.45.67.89:1533/myDB:INFORMIXSERVER=myserver;

  user=testuser;password=testpassword";

  //myDB为数据库名

  Connection conn= DriverManager.getConnection(url);

6、MySQL数据库

  Class.forName("org.gjt.mm.mysql.Driver").newInstance();

  String url ="jdbc:mysql://localhost/myDB?user=soft&password=soft1234&useUnicode=true&characterEncoding=8859_1"

  //myDB为数据库名

  Connection conn= DriverManager.getConnection(url);

7、PostgreSQL数据库

  Class.forName("org.postgresql.Driver").newInstance();

  String url ="jdbc:postgresql://localhost/myDB"

  //myDB为数据库名

  String user="myuser";

  String password="mypassword";

  Connection conn= DriverManager.getConnection(url,user,password);