/*
* This sample shows how to list all the names from the EMP table
*
* It uses the JDBC THIN driver. See the same program in the
* oci7 or oci8 samples directories to see how to use the other drivers.
*/
// You need to import the java.sql package to use JDBC
import java.sql.*;
class Employee
{
public static void main (String args [])
throws SQLException
{
// Load the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// Connect to the database
// You must put a database name after the @ sign in the connection URL.
// You can use either the fully specified SQL*net syntax or a short cut
// syntax as <host>:<port>:<sid>. The example uses the short cut
syntax.
Connection conn =
DriverManager.getConnection
("jdbc:oracle:thin:@dlsun511:1721:dbms733",
"scott", "tiger");
// Create a Statement
Statement stmt = conn.createStatement ();
// Select the ENAME column from the EMP table
ResultSet rset = stmt.executeQuery ("select ENAME from EMP");
// Iterate through the result and print the employee names
while (rset.next ())
System.out.println (rset.getString (1));
}
}
Tem esse exmplo que vem junto com Oracle no diretorio JDBC dentro do zip
que tem,
para maiores informacoes pesquise na OTN la tem muitos exemplos de programas
em java.
----- Original Message -----
From: "Rodrigo Almeida" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, January 30, 2001 3:48 PM
Subject: [java-list] exemplo de conexao com oracle
> estou precisando de algum exemplo de conexao com um banco de dados
oracle...
> estamos fazendo uma aplicacao simples que compara alguns arquivos de um
> diretorio especifico com as versoes desses arquivos referenciadas no banco
> de dados...soh estamos com problemas para fazer a conexao com esse banco
>
> sem mais
> Rodrigo
>
>
> ------------------------------ LISTA SOUJAVA ----------------------------
> http://www.soujava.org.br - Sociedade de Usuários Java da Sucesu-SP
> dúvidas mais comuns: http://www.soujava.org.br/faq.htm
> regras da lista: http://www.soujava.org.br/regras.htm
> para sair da lista: envie email para [EMAIL PROTECTED]
> -------------------------------------------------------------------------
>
>
------------------------------ LISTA SOUJAVA ----------------------------
http://www.soujava.org.br - Sociedade de Usuários Java da Sucesu-SP
dúvidas mais comuns: http://www.soujava.org.br/faq.htm
regras da lista: http://www.soujava.org.br/regras.htm
para sair da lista: envie email para [EMAIL PROTECTED]
-------------------------------------------------------------------------