Erro:
run: nov 15, 2015 8:00:10 PM br.com.teste.acessobd.AcessoFirebird conectar Não foi possível conectar ao banco!!! GRAVE: null org.firebirdsql.jdbc.FBSQLException: Resource Exception. I/O error during "CreateFile (open)" operation for file "c:\firebird\empresa.fdb" Error while trying to open file null Reason: I/O error during "CreateFile (open)" operation for file "c:\firebird\empresa.fdb" Error while trying to open file null at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:106) at org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:221) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at br.com.teste.acessobd.AcessoFirebird.conectar(AcessoFirebird.java:42) at br.com.teste.acessobd.AcessoFirebird.<init>(AcessoFirebird.java:31) at br.com.teste.acessobd.AcessoFirebird.main(AcessoFirebird.java:27) at org.firebirdsql.gds.GDSException: I/O error during "CreateFile (open)" operation for file "c:\firebird\empresa.fdb" Error while trying to open file null at org.firebirdsql.jgds.GDS_Impl.readStatusVector(GDS_Impl.java:1758) at org.firebirdsql.jgds.GDS_Impl.receiveResponse(GDS_Impl.java:1711) at org.firebirdsql.jgds.GDS_Impl.isc_attach_database(GDS_Impl.java:296) at org.firebirdsql.jgds.GDS_Impl.isc_attach_database(GDS_Impl.java:258) at org.firebirdsql.jca.FBManagedConnectionFactory.createDbHandle(FBManagedConnectionFactory.java:540) at org.firebirdsql.jca.FBManagedConnection.<init>(FBManagedConnection.java:88) at org.firebirdsql.jca.FBManagedConnectionFactory.createManagedConnection(FBManagedConnectionFactory.java:366) at org.firebirdsql.jca.FBStandAloneConnectionManager.allocateConnection(FBStandAloneConnectionManager.java:60) at org.firebirdsql.jdbc.FBDataSource.getConnection(FBDataSource.java:103) at org.firebirdsql.jdbc.FBDriver.connect(FBDriver.java:221) at java.sql.DriverManager.getConnection(DriverManager.java:664) at java.sql.DriverManager.getConnection(DriverManager.java:247) at br.com.teste.acessobd.AcessoFirebird.conectar(AcessoFirebird.java:42) at br.com.teste.acessobd.AcessoFirebird.<init>(AcessoFirebird.java:31) at br.com.teste.acessobd.AcessoFirebird.main(AcessoFirebird.java:27) CONSTRUÍDO COM SUCESSO (tempo total: 0 segundos)
Como arrumar isso?
Código usado:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package br.com.teste.acessobd; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author Marcia */ public class AcessoFirebird { Connection con; PreparedStatement pstm; ResultSet rs; public static void main (String args[]) { new AcessoFirebird(); } public AcessoFirebird() { conectar(); } public void conectar() { try { Class.forName("org.firebirdsql.jdbc.FBDriver"); } catch (ClassNotFoundException ex) { Logger.getLogger(AcessoMySql.class.getName()).log(Level.SEVERE, null, ex); System.out.println("Não foi possível encontrar o Drive!!!"); } try { con = DriverManager.getConnection("jdbc:firebirdsql:localhost/3050:c:\\firebird\\empresa.fdb", "sysdba", "masterkey"); } catch (SQLException ex) { Logger.getLogger(AcessoMySql.class.getName()).log(Level.SEVERE, null, ex); System.out.println("Não foi possível conectar ao banco!!!"); } } public void desconectar() { try { con.close(); } catch (SQLException ex) { Logger.getLogger(AcessoMySql.class.getName()).log(Level.SEVERE, null, ex); } } }