Subject Re: [Firebird-Java] Re: Firebird connectivity
Author Juan Pedro López Sáez
> 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