import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.DriverManager;
import java.sql.SQLException;
public class principal {
static final String JBDC_DRIVE= "oracle.jdbc.driver.OracleDriver";
static final String Database_url="jdbc:oracle:thin:@127.0.0.1:1521:XE";
/**
* @param args
*/
public static void main(String[] args) {
Connection connection =null;
Statement statement = null;
ResultSet resultset;
try{
Class.forName(JBDC_DRIVE);
connection = DriverManager.getConnection(Database_url,"guilherme","123");
statement = connection.createStatement();
boolean verifica = statement.execute("insert into fabrica values('guilherme','20')");
if(!!verifica)
{
System.out.println("foi inserido com sucesso");
}
else
System.out.println("nao foi inserido problemas com sql");
System.out.println("");
}
catch(SQLException e)
{
e.printStackTrace();
System.exit(1);
}
catch(ClassNotFoundException classnot)
{
classnot.printStackTrace();
System.exit(1);
}
// TODO Auto-generated method stub
}
}
vc poder me ajuda o sql ta certo e mais ele nao acha a tabela no banco de dandos… mais ele se connecta ao banco
