简体   繁体   English

Oracle 10g与Java的连接

[英]Oracle 10g connection with Java

what are the drivers which are used to connect with java for Desktop application. 什么是用于与Java for Desktop应用程序连接的驱动程序。 i have found many types like tiny and all but was not able to understand. 我发现了很多类型,例如微小的,但都无法理解。 Please help me out 请帮帮我

To make your life easier, I would recommend just using Oracle's Thin Driver. 为了使您的生活更轻松,我建议您仅使用Oracle的Thin Driver。

First, download the driver from Oracle's site : 首先,从Oracle网站下载驱动程序:

http://www.oracle.com/technetwork/database/features/jdbc/index-091264.html

Then add JAR to your project and connect to database using: 然后将JAR添加到您的项目中,并使用以下命令连接到数据库:

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

Connection conn = DriverManager.getConnection
        ("jdbc:oracle:thin:@//localhost:1521/orcl", "scott", "tiger");

Of course, replace these parameters with the ones corresponding to your DB. 当然,将这些参数替换为与您的数据库相对应的参数。

Have you looked into official site 你看过官方网站了

See Also 也可以看看

for oracle 10g the JDBC driver is "ojdbc10_g.jar" 对于oracle 10g,JDBC驱动程序是“ ojdbc10_g.jar”

it is available on your system inside %ORACLE_HOME\\jdbc\\lib No need to download. 它在您的系统上的%ORACLE_HOME \\ jdbc \\ lib中可用,无需下载。

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

Connection conn = DriverManager.getConnection         ("jdbc:oracle:thin:@//localhost:1521/orcl", "scott", "tiger"); 

conn.setAutoCommit(false);

The "thin" driver is a 100% java implementation. “瘦”驱动程序是100%java实现。 The OCI calls the C implementation. OCI调用C实现。 There might even be a JDBC to ODBC bridge, allowing you to use your system's ODBC driver. 甚至可能存在JDBC到ODBC的桥,从而允许您使用系统的ODBC驱动程序。 Suggested reading: Oracle Instant Client 建议阅读: Oracle Instant Client

The easiest one to deploy is probably the type 4 driver, or the thin driver. 部署最简单的驱动程序可能是Type 4驱动程序或瘦驱动程序。 I say it is the easiest because it does not rely on any Oracle native libraries or client install to operate. 我说这是最简单的,因为它不依赖任何Oracle本机库或客户端安装来运行。 It is readily available from Oracle . 它可以从Oracle立即获得

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM