JDBC连接

来源:互联网 发布:启用windows updata 编辑:程序博客网 时间:2024/05/21 23:46

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

object browser for windows
看oracle的内容
1 安装oracle客户端,网络=典型,服务名[全局数据库]=adminSys,主机名=192.168.0.100,用户=admit,pwd=*****
  参考jdbc配置
 DBConnectDriver = oracle.jdbc.driver.OracleDriver
 DBConnectURL = jdbc:oracle:thin:@192.168.0.100:1521:adminSys
 DBMaxCount = 50
 DBUser  = admit
 DBPassword = wuyue
2 安装object viewer
3 配置object viewer, BDEADMIN,
configuration: drivers/native/orcle: dll32=sqlora8.dll, vendor init=oci.dll,改一下,出现三角,保存,关闭所有ov程序,
启动object viewer
user id=admit
pwd=wuyue
host string=adminsys
======================
对应oracle sql*plus登录参数
用户名称=admit
口令=wuyue
主机字符串=adminSys

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

JDBC驱动汇总
作者:未知  
 Db Name: Microsoft SQL Server (6.5, 7, 2000 and 2005) and Sybase (10, 11, 12).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JDBC Name: jTDS
Home Page:
http://jtds.sourceforge.net/
JDBC Ver: 1.0.2
Download:
http://sourceforge.net/project/showfiles.php?group_id=33291
Conn Code:
  Class.forName("net.sourceforge.jtds.jdbc.Driver ");
  Connection con = DriverManager.getConnection("jdbc:jtds:sqlserver://host:port/database","user","password");
or
  Connection con = DriverManager.getConnection("jdbc:jtds:sybase://host:port/database","user","password");

  Db Name: Microsoft SQL Server 2000
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JDBC Name: SQL Server 2000 Driver for JDBC
Home Page:
http://www.microsoft.com/china/sql/
JDBC Ver: (SQL Server 2000 Driver for JDBC)
Download:
http://www.microsoft.com/china/sql/downloads/2000/jdbc.asp
Conn Code:
  Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
  Connection conn = DriverManager.getConnection ("jdbc:microsoft:sqlserver://server1:1433","user","password");

  Db Name: Oracle
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JDBC Name: Connector/J
Home Page:
http://www.oracle.com/technology/software/tech/java/
JDBC Ver: (based on Oracle)
Download:
http://www.oracle.com/technology/software/tech/java/sqlj_jdbc/
Conn Code:
  Class.forName("oracle.jdbc.driver.OracleDriver");
  Connection con = DriverManager.getConnection("jdbc:oracle:thin:@host:port:databse","user","password");

  Db Name: MySQL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JDBC Name: Connector/J
Home Page:
http://dev.mysql.com/
JDBC Ver: 3.1
Download:
http://dev.mysql.com/downloads/
Conn Code:
  Class.forName("com.mysql.jdbc.Driver");
  Connection con = DriverManager.getConnection("jdbc:mysql://host:port/database","user","password");

  Db Name: Sybase
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JDBC Name: jConnect
Home Page:
http://www.sybase.com.cn/cn/content/SDN/
JDBC Ver: 4.5/5.5
Download:
http://www.sybase.com/detail_list?id=13&morenavId=8668&multi=true&SR=Y&show=1265
Conn Code:
Class.forName("com.sybase.jdbc2.jdbc.SybDriver").newInstance();
DriverManager.getConnection("jdbc:sybase:Tds:IP:2638?ServiceName="+database,"user","password");

  Db Name: Postgresql
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JDBC Name: PostgreSQL JDBC
Home Page:
http://jdbc.postgresql.org/
JDBC Ver: 8.0 Build 310
Download:
http://jdbc.postgresql.org/download.html
Conn Code:
  Class.forName("org.postgresql.Driver");
  Connection con = DriverManager.getConnection("jdbc:postgresql://host:port/database","user","password");

  Db Name: IBM Informix
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JDBC Name: Informix JDBC Driver (IBM Informix JDBC V3.0)
Home Page:
http://www-306.ibm.com/software/data/informix/
JDBC Ver: 3.0.JC1
Download:
http://www14.software.ibm.com/webapp/download/search.jsp?go=y&rs=ifxjdbc
Conn Code:
  Class.forName("com.informix.jdbc.IfxDriver").newInstance();
  Connection conn= DriverManager.getConnection("jdbc:informix-sqli://123.45.67.89:1533/myDB:INFORMIXSERVER=myserver;user=testuser;password=testpassword";);

  Db Name: IBM DB2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
JDBC Name: DB2 JDBC Universal Driver
Home Page:
http://www-306.ibm.com/software/data/db2/udb/
JDBC Ver:
Download:
http://www-128.ibm.com/developerworks/db2/downloads/jcc/
Conn Code:
  Class.forName("com.ibm.db2.jdbc.app.DB2Driver ").newInstance();
  Connection conn= DriverManager.getConnection("jdbc:db2://localhost:5000/sample",user,password);

IBM AS400主机在用的JDBC语法
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  有装V4R4以上版本的Client Access Express
  可以在C:/Program Files/IBM/Client Access/jt400/lib
  找到 driver 档案 jt400.zip,并更改扩展名成为 jt400.jar
Conn Code:
  java.sql.DriverManager.registerDriver (new com.ibm.as400.access.AS400JDBCDriver ());
  Class.forName("com.ibm.as400.access.AS400JDBCConnection");
  con = DriverManager.getConnection("jdbc:as400://IP","user","password");

  Db Name: Ms Access or Ms Foxpro
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Conn Code:
  step 1: 配置 odbc (例如:myDb)
  step 2:
  String dbURL = "jdbc:odbc:myDb";
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
 Connection conn = DriverManager.getConnection(dbURL);
or
  String dbURL = "jdbc:odbc:driver={MicrosoftAccessDriver(*.mdb)};DBQ=dabaseName.mdb";
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
 Connection conn = DriverManager.getConnection(dbURL);

@@@@@@@@@@@@@@mssql驱动的安装@@@@@@@@@@@@@@

     Install.txt
     Microsoft SQL Server 2000 JDBC Driver
     Version 2.1
     September 2001


Windows
-------

To install on Windows platforms:

1. Download Setup.exe to a temporary folder on your hard disk.

2. Run Setup.exe from that folder and follow the on-screen instructions.


UNIX
----

To install on UNIX platforms:

1. Copy the Mssqlserver.tar file from the Unix folder to a temporary folder on your
computer.

2. From that temporary folder, use the following command to extract and the contents of the
file:

   tar -xvf mssqlserver.tar

The contents of the tar file will appear in the directory.

3. Use the following command to run the installation script:

   install.ksh

If you want to exit the script at any time, press CTRL+C.

4. You are asked if you want to view the license agreement. Press
ENTER to proceed.

5. After viewing the license agreement, press ENTER to accept it or N
to exit.

6. You are asked to specify an installation directory. Enter the full
path to the directory.

7. The script displays a message when the installation is complete.


--------------
End of Install.txt

您的位置: 首页>>开发者>>JAVA>>查看文章
JAVA/jsp SQL Server for JDBC的安装与配置
来源: 今晚在线   作者: 我容易么我   类别: 原创   时间: 2005-3-24   浏览: 3952
【大    中    小】   依我之见    推荐给朋友    打印文档
很久没写东西了,最近终于整理出一片JAVA以JDBC连接数据库的东西,放出来分享给大家。

现介绍一下我的JAVA(jsp)环境,尽管似乎和这个无关。

操作系统:windows 2003

JDK :jdk-1_5_0-windows-i586.exe

jsp容器:jakarta-tomcat-5.5.4.exe

好了进入正题。。。。。

1/   建议安装Microsoft SQL Enterprise Manager Microsoft Corporation版本: 8.0及Microsoft SQL Server SP3。另外,您可以在
http://www.microsoft.com/downloads/details.aspx?displaylang=zh-cn&FamilyID=90dcd52c-0488-4e46-afbf-acace5369fa3下载并获得SP3的更多的信息。
为了方便大家本站也提供下载 /d/chs_sql2ksp3.exe

2/ 下载SQL Server 2000 Driver for JDBC 驱动程序
可以在
http://www.microsoft.com/downloads/details.aspx?FamilyId=07287B11-0502-461A-B138-2AA54BFDC03A&displaylang=en下载最新版本SQL Server 2000 Driver for JDBC SP3。
本站下载地址 /d/JDBC.exe

驱动程序按照提示安装即可。建议安装目录:C:/Program Files/Microsoft SQL Server 2000 Driver for JDBC

3/ 安装完成后,鼠标右击[我的电脑]-弹出菜单中选择[属性]-弹出对话框中选择[高级]-点击[环境变量]
面操作在[系统变量]中进行,如果系统变量已存在相同变量名且包含相同变量值,则跳过该步操作;如果系统变量已存在相同变量名但未包含相同变量值,则添加该变量值(用英文“;”隔开);如果系统变量不存在相同变量名,则按如下操作

[新建]变量名:JDBC_Home  变量值:
C:/Program Files/Microsoft SQL Server 2000 Driver for JDBC 

[新建]变量名:ClassPath     变量值:
%JDBC_Home%/lib/msbase.jar;%JDBC_Home%/lib/mssqlserver.jar;%JDBC_Home%/lib/msutil.jar;

如果没安装过 JDBC驱动那么系统变量 JDBC_HOME 的操作应该是[新建],而由于您安装JDK的时候新建过CLASSPATH变量则下步应该是编辑CLASSPATH变量名

最后重启计算机,完成JDBC配置。


补充:
建议将%JDBC_Home%/lib/msbase.jar;%JDBC_Home%/lib/mssqlserver.jar;%JDBC_Home%/lib/msutil.jar三个文件拷贝至%Java_Home%/jre/lib/ext目录下和%Tomcat_Home%/common/lib目录下。


最后我们写个JAVA文件来测试下。。

 

 

原创粉丝点击