Problem de connection

Résolu
fantbel Messages postés 6 Date d'inscription jeudi 17 juin 2004 Statut Membre Dernière intervention 19 novembre 2006 - 16 nov. 2006 à 16:38
fantbel Messages postés 6 Date d'inscription jeudi 17 juin 2004 Statut Membre Dernière intervention 19 novembre 2006 - 19 nov. 2006 à 12:54
bonjour,
alors j'utilise netbeans ide 5.5 en edi

mon environnement est jdk1.5.0_09 et jre1.5.0_09

j'essaie de faire un test pour me connecter a une base de donnée firebird


donc je cree un nouveau projet:

je clique dans "property" du projet puis dans libraries

j'inclus les jar via "Add JAR/Folder" suivants :

jaas.jar, log4j-core.jar, mini-j2ee.jar, jaybird-full-2.0.1.jar

j'ecris juste ce code ci-dessous :

public static void main(String[] args) throws SQLException {

try {

// TODO code application logic here

Class.forName ("org.firebirdsql.jdbc.FBDriver");


String databaseURL = "jdbc:firebirdsql:local:C:/MaBase.GDB";

String user = "SYSDBA";

String password = "masterkey";


Connection conn = DriverManager.getConnection(databaseURL, user, password);


System.out.println("--- hihihi, CA MARCHE ) ---");


} catch (ClassNotFoundException ex) {

ex.printStackTrace();

System.err.println("!!! Olala, CA MARCHE PAS, snifsnif ;'( !!!");

}

}

 et malheureusement j'obtiens ce message suivant :


Compiling 1 source file to G:\jsource\JavaApplication1\build\classes

Copying 1 file to G:\jsource\JavaApplication1\build\classes

compile:

run:

org.firebirdsql.gds.impl.jni.InternalError: FirebirdApiBinding::Initialize - Could not find or load the GDS32.DLL

at org.firebirdsql.gds.impl.jni.JniGDSImpl.nativeInitilize(Native Method)

at org.firebirdsql.gds.impl.jni.JniGDSImpl.attemptToLoadAClientLibraryFromList(JniGDSImpl.java:85)

at org.firebirdsql.gds.impl.jni.LocalGDSImpl.(LocalGDSImpl.java:29)

at org.firebirdsql.gds.impl.jni.LocalGDSImpl.(LocalGDSImpl.java:19)

at org.firebirdsql.gds.impl.jni.LocalGDSFactoryPlugin.getGDS(LocalGDSFactoryPlugin.java:40)

at org.firebirdsql.gds.impl.GDSFactory.getGDSForType(GDSFactory.java:220)

at org.firebirdsql.jca.FBManagedConnectionFactory.getGDS(FBManagedConnectionFactory.java:110)

at org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:125)

at java.sql.DriverManager.getConnection(DriverManager.java:525)

at java.sql.DriverManager.getConnection(DriverManager.java:171)

at javaapplication1.Main.main(Main.java:40)

org.firebirdsql.gds.impl.jni.InternalError: FirebirdApiBinding::Initialize - Could not find or load the GDS32.DLL

at org.firebirdsql.gds.impl.jni.JniGDSImpl.nativeInitilize(Native Method)

at org.firebirdsql.gds.impl.jni.JniGDSImpl.attemptToLoadAClientLibraryFromList(JniGDSImpl.java:85)

at org.firebirdsql.gds.impl.jni.LocalGDSImpl.(LocalGDSImpl.java:29)

at org.firebirdsql.gds.impl.jni.LocalGDSImpl.(LocalGDSImpl.java:19)

at org.firebirdsql.gds.impl.jni.LocalGDSFactoryPlugin.getGDS(LocalGDSFactoryPlugin.java:40)

at org.firebirdsql.gds.impl.GDSFactory.getGDSForType(GDSFactory.java:220)

at org.firebirdsql.jca.FBManagedConnectionFactory.getGDS(FBManagedConnectionFactory.java:110)

at org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:125)

at java.sql.DriverManager.getConnection(DriverManager.java:525)

at java.sql.DriverManager.getConnection(DriverManager.java:171)

at javaapplication1.Main.main(Main.java:40)


j'ai essayé de placer la dll a cote des *.class dans windows/system32 etc... rien n'y fait

Si qqn a une idee, merci bcp

2 réponses

mouzart Messages postés 161 Date d'inscription mardi 26 avril 2005 Statut Membre Dernière intervention 6 novembre 2008 4
17 nov. 2006 à 17:42
slt,
  Il me semble k il ya une config a faire pour t a base de donne avant de passer par le driver. Par exemple pour une base MS SQL il faut la configurer en creant une data source et lui associant le driver SQL server. pour cela tu dois aller paneau de configuraTION-> administrative sorces-> sources. C est a peu pres kelke chose comme ca .
3
fantbel Messages postés 6 Date d'inscription jeudi 17 juin 2004 Statut Membre Dernière intervention 19 novembre 2006
19 nov. 2006 à 12:54
a merci en fait en me cassant la tete en essayant ca g trouve un moyen  de contourne ce probleme alors voici le code qui marche si ca interresse qqn

///////////////////////////////////////////////////////////////////////
import java.net.ConnectException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Vector;

/**
 *
 * @author
 */
public class JFBConnexion
{
    String databaseDath;
    String user;
    String password;
    Connection conn; 
    Vector listeTables;
   
    /** Creates a new instance of JFBConnexion */
    public JFBConnexion (String path,String log, String pass) throws ClassNotFoundException, SQLException
    {
        databaseDath = path;
        user = log;
        password = pass;
        Class.forName ("org.firebirdsql.jdbc.FBDriver");
        conn = DriverManager.getConnection("jdbc:firebirdsql://" + databaseDath, user, password);
        listeTables = new Vector();
    }
   
    public Statement GetNewStatement() throws SQLException
    {
        Statement st = conn.createStatement();
        return st;
    }
   
}

//////////////////////////////////////////////////////////////////////////////////////////

package GCodeJava;

import jFBConnect.JFBConnexion;
import java.sql.*;
public class Main {
   
    /** Creates a new instance of Main */
    public Main() throws SQLException {
    }
   
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws SQLException {
        // TODO code application logic here
        try {
            JFBConnexion conn = new JFBConnexion("127.0.0.1/C:/MABASE.FDB",
                        "SYSDBA", "masterkey");
        System.out.println("ca a marche");
        } catch (Exception e) {
            System.out.println("ca n'a pas marche " + e.getMessage());
        }
    }
   

//////////////////////////////////////////////////////////////////////////////////////////

je crois que je vais construire un jar contenant l'essentiel (jaybird+class perso) pour ne plus avoir a se casser la tete avec en entree une simple classe avec com constructeur un
public JFBConnexion (String IP, String path,String log, String pass)

avec IP et path il faut construire une chaine du type
"jdbc:firebirdsql://127.0.0.1/C:/MABASE.FDB"

le corps de la fct construira une chaine
"jdbc:firebirdsql://" + IP + "/" + path

mais c bizar car dans la doc de jaybird avec :local ca devrai fonctionner ;)
 thanks yu very much
3
Rejoignez-nous