Subject RES: [Firebird-Java] Re: Firebird connectivity
Author Francisco Vieira
try
{
Class.forName("org.firebirdsql.jdbc.FBDriver");
}
catch(ClassNotFoundException cnfe)
{
JOptionPane.showMessageDialog(this, cnfe,
"Driver",JOptionPane.ERROR_MESSAGE);
return;
}

try
{
Statement stmt = null;
ResultSet rst = null;
String bancoDeDados = "C:\\Transp\\Data\\DADOS.GDB";
String usuario = "sysdba";
String senha = "masterkey";
String sql = "";
Connection c =
DriverManager.getConnection("jdbc:firebirdsql:localhost/3050:" +
bancoDeDados,usuario,senha);
}
catch (SQLException ex)
{
JOptionPane.showMessageDialog(this, ex,
"Error",JOptionPane.ERROR_MESSAGE);
}


>>-----Mensagem original-----
>>De: Juan Pedro López Sáez [mailto:jpls@...]
>>Enviada em: terça-feira, 16 de setembro de 2003 04:07
>>Para: Firebird-Java@yahoogroups.com
>>Assunto: Re: [Firebird-Java] Re: Firebird connectivity
>>
>>
>>> These are my error messages I am getting with previous examples.
>>>
>>> C:\PCCashRegister\PCCashReg.java:25: unreported exception
>>> java.lang.ClassNotFoundException; must be caught or declared to be
>>> thrown
>>> Class.forName(JDBC_DRIVER);
>>> ^
>>> C:\PCCashRegister\PCCashReg.java:28: unreported exception
>>> java.sql.SQLException; must be caught or declared to be thrown
>>> connection = DriverManager.getConnection(DBpath);
>>> ^
>>> 2 errors
>>> JCompiler done.
>>>
>>>
>>
>>
>>This is not a Jaybird especific error.
>>
>>Both Class.forName and DriverManager.getConnection throw an exception,
>>so you must catch them or declare them to be thrown.
>>
>>Example:
>>
>>try {
>> Class.forName(JDBC_DRIVER);
>>}
>>catch (classNotFoundException ex) {
>>
>> ... exception handling code must be here ...
>>}
>>
>>Regards,
>>
>>Juan Pedro Lopez.
>>
>>
>>
>>
>>> --- In Firebird-Java@yahoogroups.com, "batsoww" <batsoww@y...> wrote:
>>> > Can someone give an example of exactly what would go in
>>> Class.forName
>>> > (JDBC_DRIVER) and DriverManager.getConnection(DATABASE_URL).
>>> > I need to see an exact example of what goes inside the JDBC_DRIVER
>>> > and DATABASE_URL spaces.
>>> >
>>> > Thanks,
>>> > Batsoww
>>> > --- In Firebird-Java@yahoogroups.com, John Zoetebier
>>> > <john.zoetebier@t...> wrote:
>>> > > On Thu, 11 Sep 2003 18:42:40 -0000, batsoww <batsoww@y...> wrote:
>>> > >
>>> > > > Hi, I am new to the world of Firebird and Java and I was
>>> > wondering
>>> > > > what the basic syntax of the database url and the driver url
>>> > would
>>> > > > look like. I am reading the database url from a file and
>>> passing
>>> > it
>>> > > > to the DriverManager.connection(Database_URL);
>>> > > >
>>> > > > I just don't understand how to write the actual URL's in the
>>> > correct
>>> > > > format in order to connect to the database.
>>> > > >
>>> > >
>>> > > When you download FireBird there is a file FAX.txt.
>>> > > From that file:
>>> > > ==>
>>> > > Two forms of JayBird can be used. FBDriver is used much like the
>>> > old
>>> > > Interclient driver. FBWrappingDataSource has internal connection
>>> > pooling
>>> > > capability. Examples of both are included here. Code examples of
>>> > many of
>>> > > the classes and methods used by JayBird can be found in the
>>> > src/test
>>> > > subdirectory of the source code available on SourceForge.net,
>>> see
>>> > question
>>> > > 13 below.
>>> > >
>>> > > JayBird supports two URL syntax formats:
>>> > >
>>> > > Standard format= jdbc:firebirdsql:[//host[:port]/]<database>
>>> > >
>>> > > FB old format= jdbc:firebirdsql:[host[/port]:]<database>
>>> > > ==>
>>> > >
>>> > > Furthermore there is a samples folder with 2 Java programs.
>>> > > The <database> is the qualified name of the database, i.e.
>>> > includes the
>>> > > path.
>>> > >
>>> > > --
>>> > > John Zoetebier
>>> > > Web site: http://www.transparent.co.nz
>>>
>>>
>>> Yahoo! Groups Sponsor
>>> ADVERTISEMENT
>>> click here
>>>
>>> To unsubscribe from this group, send an email to:
>>> Firebird-Java-unsubscribe@yahoogroups.com
>>>
>>>
>>>
>>> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>>--
>>Juan Pedro López Sáez
>>ALTIRIA TIC, S.L.L.
>>www.altiria.com
>>
>>
>>
>>
>>To unsubscribe from this group, send an email to:
>>Firebird-Java-unsubscribe@yahoogroups.com
>>
>>
>>
>>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>>
>>---
>>Incoming mail is certified Virus Free.
>>Checked by AVG anti-virus system (http://www.grisoft.com).
>>Version: 6.0.516 / Virus Database: 313 - Release Date: 01/09/2003
>>
---
Outgoing mail is certified Virus Free.

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.516 / Virus Database: 313 - Release Date: 01/09/2003