Subject Re: [Firebird-Java] Connection Java_Firebird
Author Antonio Petrelli
Put the calls to DriverManager.getConnnection and createStatement inside
the "try" block, it should compile.
Greetings
Antonio

Allysson Costa wrote:

> I have trying for a long time make a
> connection between java e firebird
> without sucesful. Can anyone help me.
>
> The error message is:
>
> bdados.java [125:1] unreported
> exception java.sql.SQLException; must
> be caught or declared to be thrown
> conexao =
> DriverManager.getConnection("jdbc:firebirdsql:localhost/3050:/var/intranet/bdados/bdados.gdb","sysdba","masterkey");
>
> My code is:
>
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> try
> {
>
> Class.forName("org.firebirdsql.jdbc.FBDriver").newInstance();
>
> }
> catch (Exception E)
> {
> System.err.println("Unable to load
> driver.");
> E.printStackTrace();
> }
>
> Connection conexao =
> DriverManager.getConnection
> ("jdbc:firebirdsql:localhost/3050:/var/intranet/bdados/bdados.gdb","sysdba","masterkey");
>
> Statement stmt =
> conexao.createStatement();
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> What are the imports I need to do?
> I made:
> import java.io.*;
> import java.sql.*;
> import org.firebirdsql.encodings.*;
> import org.firebirdsql.gds.*;
> import org.firebirdsql.jca.*;
> import org.firebirdsql.jdbc.*;
> import org.firebirdsql.jgds.*;
> import org.firebirdsql.logging.*;
> import org.firebirdsql.management.*;
> import java.util.*;
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
>
> Thanks,
>
> Allysson