[Java] JDBC SQL2008

Forum destiné aux questions sur le développement : Formules, LotusScript, Java ...

[Java] JDBC SQL2008

Messagepar KHVince » 06 Mars 2012 à 10:33

Bonjour,

Une fonctionnalité de mon site me permet de créer un fichier pdf en récupérant différentes info d'un base sql.
Fonctionnalité faite par un agent java avec la bibliothèque sqljdbc pour me connecter à la base SQL 2000.
Nous avons monté un serveur SQL2008, en vue d'une proche migration de nos bases sql, puis effectué quelques tests et mon agent ne fonctionne plus. Il n'arrive pas à se connecter au serveur SQL et j'ai l"erreur suivante :
Code : Tout sélectionner
HTTP JVM:    at com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
HTTP JVM:    at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(Unknown Source)
HTTP JVM:    at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(Unknown Source)
HTTP JVM:    at java.sql.DriverManager.getConnection(DriverManager.java:316)
HTTP JVM:    at java.sql.DriverManager.getConnection(DriverManager.java:353)
HTTP JVM:    at ConnectSQL.getConnection(Unknown Source)
HTTP JVM:    at CreatePDF.getAlerteImpressionData(Unknown Source)
HTTP JVM:    at CreatePDF.setPrintPDF(Unknown Source)
HTTP JVM:    at JavaAgent.NotesMain(Unknown Source)
HTTP JVM:    at lotus.domino.AgentBase.runNotes(Unknown Source)
HTTP JVM:    at lotus.domino.NotesThread.run(Unknown Source)
HTTP JVM: ConnectSQL - Error SQLException Trace in getConnection() : Échec de la connexion TCP/IP à l'hôte . com.microsoft.sqlserver.jdbc.SQLServerException: Cette version de serveur n'est pas prise en charge. Le serveur cible doit être SQL Server 2000 ou supérieur


Au niveau de mon code Java :
Code : Tout sélectionner
   
public class ConnectSQL {
   
...

   private Connection  con = null;
   private final String JDBCDriver = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
   private final String url = "jdbc:sqlserver://";
   private final String portNumber = "1433";
   private final String selectMethod = "cursor";
   private final int LTimeOut = 10; //--> pour le setLoginTimeOut (en seconde)
   private final int QTimeOut = 10; //--> pour le setQueryTimeOut (en seconde)

...

    public ConnectSQL(String[] args){
       this.dbName         = args[0];
       this.serverName    = args[1];
       this.userSQL       = args[2];
       this.passwordSQL    = args[3];
       this.instanceSQL   = args[4];
    }

...

        private String getConnectionUrl(){
       
       String chaineConn = "";
       FormatData formatData = new FormatData();
       
       if (formatData.emptyStr(instanceSQL)){
          chaineConn = url+serverName+";instanceName="+instanceSQL+";databaseName="+dbName+";selectMethod="+selectMethod+";";
       } else {
          chaineConn = url+serverName+":"+portNumber+";databaseName="+dbName+";selectMethod="+selectMethod+";";
       }
        return chaineConn;
   }

    public Connection getConnection(){
        try{
             Class.forName(JDBCDriver);
             DriverManager.setLoginTimeout(LTimeOut);
             con = DriverManager.getConnection(getConnectionUrl(),userSQL,passwordSQL);
             
      }catch(SQLException e2){
         System.err.println("ConnectSQL - Error SQLException Trace in getConnection() : " + e2.getMessage());
      }catch(Exception e){
         e.printStackTrace();
         System.out.println("ConnectSQL - Error Exception Trace in getConnection() : " + e.getMessage());
      }
        return con;
    }

...


Sachant qu'avec le serveur SQL2000, tout fonctionne correctement.

J'ai mis à jour de la bib jdbc. J'avais la v2 que j'ai passé en v3 sans changement puis en v4 sans changement non plus...
Le .jar est dans le rep \jvm\lib\ext avec référence dans le notes.ini

J'avoue que je sèche donc si vous aviez quelques pistes...

Merci,
Vincent
KHVince
Premier posts
Premier posts
 
Message(s) : 13
Inscrit(e) le : 19 Mars 2009 à 16:17

Retour vers Développement