----- Original Message -----
Sent: Wednesday, June 04, 2003 7:21
AM
Subject: [enterprise-list] JDBC -
Oracle
Algum colega poderai me dar um auxilio
nesta conexao, e me dizer o q esta errado ??
obrigado
jose antonio
************************************************************
import java.sql.*;
import
java.awt.*;
import java.io.*;
import java.util.*;
public class JdbcApplet extends
java.applet.Applet
{
static final String query = "select
'Hello JDBC: ' || sysdate from dual";
Button
execute_button;
TextArea output;
Connection conn;
public void init ()
{
this.setLayout (new BorderLayout
());
Panel p = new Panel ();
p.setLayout (new FlowLayout (FlowLayout.LEFT));
execute_button = new Button ("Hello JDBC");
p.add
(execute_button);
this.add ("North",
p);
output = new TextArea (10,
60);
this.add ("Center", output);
}
public boolean action (Event ev,
Object arg)
{
if (ev.target ==
execute_button)
{
try
{
if (conn == null)
{
// pq esta dando ero na linha abaixo
??
DriverManager.registerDriver (new oracle.jdbc.OracleDriver());
conn =
DriverManager.getConnection ("jdbc:oracle:thin:@10.30.0.249:1521:scg",
"scott", "scott");
output.appendText
("Connected\n");
}
Statement stmt =
conn.createStatement ();
output.appendText ("Executing query
" + query + "\n");
ResultSet rset = stmt.executeQuery
(query);
while (rset.next ())
output.appendText (rset.getString (1) + "\n");
output.appendText
("done.\n");
}
catch (Exception
e)
{
output.appendText
(e.getMessage () + "\n");
}
return true;
}
else
return
false;
}
}