Conexão com firebird problematica

0 respostas
zerokelvin

Opa,

num topico anterior postei uma class que quando jogada prum jar não conectava ao firebird nem com missa,
ae peguei o exemplo da documentação do driver e ele me retorna uma conexão nula, sem nenhum erro…

static boolean FBDriverLoaded = false;
      static org.firebirdsql.jdbc.FBWrappingDataSource fbwds = null;
     
     
      static public void main (String args[]) throws Exception
      {
      // Create an Firebird data source manually;
      
         org.firebirdsql.pool.FBWrappingDataSource dataSource = 
            new org.firebirdsql.pool.FBWrappingDataSource();
      
      // Set the standard properties
 tentei colocando na string a porta e o ip do servidor.. mas da na mesma
         dataSource.setDatabase ("C://Users//User//Desktop//08112010.GDB");
         System.out.println(dataSource.toString());
         dataSource.setDescription ("An example database of employees");
      
      /*
      * Following properties were not deleted in order to show differences 
      * between InterClient 2.01 data source implementation and Firebird one.
      */
      
      //dataSource.setDataSourceName ("Employee");
      //dataSource.setPortNumber (3050);
      //dataSource.setNetworkProtocol ("jdbc:interbase:");
      //dataSource.setRoleName (null);
      
      // Set the non-standard properties
      //dataSource.setCharSet (interbase.interclient.CharacterEncodings.NONE);
      //dataSource.setSuggestedCachePages (0);
      //dataSource.setSweepOnConnect (false);
      
      // this some kind of equivalent to dataSource.setNetworkProtocol(String)
      // possible values are "type4", "type2" and "embedded".
         dataSource.setType("EMBEDDED");
      
      // SQL Role can be set like this:
      // 
      // dataSource.setRoleName("USER");
      
      // Character encoding for the connection is set to NONE
         dataSource.setEncoding("ISO8859_1");
      
      // other non-standard properties do not have setters
      // you can pass any DPB parameter
      //
      // dataSource.setNonStandardProperty("isc_dpb_sweep", null);
      // dataSource.setNonStandardProperty("isc_dpb_num_buffers", "75");
      
      // Connect to the Firebird DataSource
         try {
            dataSource.setLoginTimeout (10);
            System.out.println(dataSource.toString());
            java.sql.Connection c = dataSource.getConnection ("sysdba", "masterkey");
         
            java.sql.Statement stmt = c.createStatement();
            java.sql.ResultSet rs = stmt.executeQuery("SELECT * FROM employee");
            while(rs.next())
               System.out.println("a1 = " + rs.getString(1) + ", a2 = " + rs.getString(2));
          
            stmt.close();
         
         // At this point, there is no implicit driver instance
         // registered with the driver manager!
            System.out.println ("got connection");
         //c.close ();
         }
            catch (java.sql.SQLException e) {
               e.printStackTrace();
               System.out.println ("sql exception: " + e.getMessage ());
            }
      }

alguem sabe o q é isso?

Criado 19 de fevereiro de 2011
Respostas 0
Participantes 1