begin process at 2012 05 27 19:35:08
  Trouver un code source :
 
dans
 
Accueil > Forum > 

ASP.NET

 > 

Base de données

 > 

Oracle

 > 

connexion oracle 10g et netbeans6.8


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

connexion oracle 10g et netbeans6.8

lundi 26 avril 2010 à 23:38:50 | connexion oracle 10g et netbeans6.8

chirazch

bonsoir
je suis debutante en java .j'essaie d'etablir une connexion entre oracle et net beans mais en vain .s'il vous plait m'aider le code ceci
package appmedic;
import java .sql.*;
import javax.swing.JOptionPane;
import java .util.logging.Level;
import java.util.logging.Logger;




/**
*
* @author l'expert
*/
public class identification extends javax.swing.JFrame {

/** Creates new form identification */
public identification() {
initComponents();


}






public class ConnectionBD{
private Connection con;
private Statement instruction;
protected ResultSet resultat;
String l_url="jdbc:oracle:thin:@localhost:1521:orcl";
String l_uid="system";
String l_pwd="ch05940563";
String l_driver="oracle.jdbc.OracleDriver";
public ConnectionBD(){
try
{
Class.forName("oracle.jdbc.OracleDriver");
con=DriverManager.getConnection(l_url, l_uid, l_pwd);
instruction=con.createStatement();
}
catch (ClassNotFoundException ex)
{
System.err.println("Problème de pilote");

}

catch(SQLException ex)
{System.err.println("Base de données non trouve ou requete incorrect");
}

}}


/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {

jTextField2 = new javax.swing.JTextField();
jPanel2 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
loge = new javax.swing.JTextField();
jButton1 = new javax.swing.JButton();
mot = new javax.swing.JPasswordField();
annuler = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jLabel4 = new javax.swing.JLabel();

jTextField2.setText("jTextField2");

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("Authentification");
setMinimumSize(new java.awt.Dimension(535, 377));
getContentPane().setLayout(null);

jPanel2.setBackground(new java.awt.Color(204, 204, 204));

jPanel1.setBackground(new java.awt.Color(204, 204, 204));
jPanel1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

jLabel1.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\l'expert\\Mes documents\\bienve\\keyword\\images.jpg")); // NOI18N
jLabel1.setText("jLabel1");
jLabel1.setToolTipText("");

jLabel2.setFont(new java.awt.Font("Tahoma", 3, 18));
jLabel2.setText("login");

jLabel3.setFont(new java.awt.Font("Tahoma", 3, 18));
jLabel3.setText("mot de passe");

loge.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
logeActionPerformed(evt);
}
});

jButton1.setFont(new java.awt.Font("Tahoma", 3, 18));
jButton1.setText("Valider");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});

mot.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
motActionPerformed(evt);
}
});

annuler.setFont(new java.awt.Font("Tahoma", 1, 18));
annuler.setText("Annuler");
annuler.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
annulerActionPerformed(evt);
}
});

jButton2.setText("ok");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});

javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 121, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel3)
.addComponent(jLabel2)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(jButton2)
.addGap(18, 18, 18)
.addComponent(jButton1)
.addGap(12, 12, 12)))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(33, 33, 33)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mot, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE)
.addComponent(loge, javax.swing.GroupLayout.DEFAULT_SIZE, 113, Short.MAX_VALUE))
.addGap(38, 38, 38))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(annuler)
.addContainerGap())))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(79, 79, 79)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(loge, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(28, 28, 28)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(mot, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2))
.addComponent(annuler)))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(49, 49, 49)
.addComponent(jLabel1)))
.addContainerGap(25, Short.MAX_VALUE))
);

jLabel4.setFont(new java.awt.Font("Tahoma", 3, 18));
jLabel4.setForeground(new java.awt.Color(204, 102, 255));
jLabel4.setIcon(new javax.swing.ImageIcon("C:\\Documents and Settings\\l'expert\\Mes documents\\Mes images\\Groupe_chimique_tunisien.jpg")); // NOI18N
jLabel4.setText("Groupe chimique tunisien");

javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(37, 37, 37)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 473, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(20, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 80, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(41, 41, 41))
);

getContentPane().add(jPanel2);
jPanel2.setBounds(0, -10, 530, 360);

getAccessibleContext().setAccessibleName("authentification");

pack();
}// </editor-fold>

private void logeActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
String l= loge.getText();
char[] k=mot.getPassword();


String c="administrateur";
String d="infirmier";
String g= "1234";
String b= "4567";
String f=String.valueOf(k);
if (l.equals(c)& f.equals(g)){
this .dispose();
new Administration().setVisible(true);
}else
if (l.equals(d)&f.equals(b)){
this.dispose();
new acceuil().setVisible(true);
}else

if ((loge.getText().equals(""))& (mot .getText().equals("")))
{
JOptionPane.showMessageDialog(this, "les champs sont déja vide!!", "verification de champ ",JOptionPane.INFORMATION_MESSAGE);
} else
{JOptionPane.showMessageDialog(this, "FAIS Attention votre login ou mot de passe est erroné", "authentification", JOptionPane.INFORMATION_MESSAGE);
}

// TODO add your handling code here:
}

private void annulerActionPerformed(java.awt.event.ActionEvent evt) {
if ((loge.getText().equals("")& (mot.getText().equals("")
))){JOptionPane.showMessageDialog(this, "les champs sont déja vide!!", "verification de champ ",JOptionPane.INFORMATION_MESSAGE);

} else{
loge.setText("");
mot.setText("");
// TODO add your handling code here:
}
}

private void motActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
}

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
if((loge.getText().equals("+login+")&(mot.getText().equals("+passe")))){
this.dispose();
new acceuil().setVisible(true);}
// TODO add your handling code here:
}

/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new identification().setVisible(true);
}
});
}

// Variables declaration - do not modify
private javax.swing.JButton annuler;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JTextField jTextField2;
private javax.swing.JTextField loge;
private javax.swing.JPasswordField mot;
// End of variables declaration



}
les bouton annuler et valider se fonctionne car il ne connecte pas au base maisle bouton ok ne fonctionne pas.
merci


Cette discussion est classée dans : java, javax, swing, awt, grouplayout


Répondre à ce message

Sujets en rapport avec ce message

sécuriser une application java [ par 208893 ] bonjours mes amis;[^^happy13] j'ai un problème de l'exécution de login et mot de passe. le problème est n'importe qui peut accéder à mon application problème d'affichage [ par tcheko225 ] je fais un programme en java NetBeane IDE 6.7.1,et le programme consist à afficher les éléments d'une base de données de diverses tables dans un table programme en java nombre binaire [ par annie301208 ] Bonjour , j'ai du mal a ecrire un programme en java consernant les nombres binaires , pouvez vous m'aider ? Merci . je dois ecrire en java un programm adresse IP [ par tcheko225 ] j'ai écrit un programe qui apparemmet devrait me donner les adresses IP des postes connectés au réseau,dans la forme il n'y'a pas d'erreur.Voici le co Activedirectory [ par tcheko225 ] J'écris un programme qui doit communiquer avec ActiveDirectory de windows 2003 Server quand je le met il n'y'a pas d'erreur,voici le code: package rés algorithme DES en java [ par bdalila45 ] salam je veut implémenter l'algorithme DES mais j'ai pas su comment déclarer le bloc en 16 bits et la clé en 12bit merci pour votre aide[^^confus2] code java [ par meryemmajda ] je cherche edes exemple de code sur les sockets Question sur java [ par kratos60 ] Bonjour a tous, Je me permet de poster car mon probleme dur depuis trop longtemps(3h) et quoi que je face je ne trouve pas de solution... Alors voil gestion de bibliothèque en java [ par souad25 ] bonjour je veut créé un programme en java gestion de bibliothèque.j'ai créé les classes(document personne,et une classe associative emprunte)et une i


Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,749 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales