Subject | So: connect works better |
---|---|
Author | Jean Noël Martin |
Post date | 2010-10-31T16:10:16Z |
Ok It was realy a problem of NetBean Configuration. it's works fine and I go on
Thanks for your help
Thanks for your help
--- In Firebird-Java@yahoogroups.com, Jean Noël Martin <jnm53@...> wrote:
>
> Hi
> I thak you very much for your indication. This was a great help for me
> However I hava a problem to reproduce your demo.
> on the 3d step you wrote:
> new project
> > - Add Library
> > - Select 'Jaybird-2.1.6' library from the list
> I go to this step and when I have selected Jaybird-2.1.6, I clicked on add Library and nothing occurs????
>
> --- In Firebird-Java@yahoogroups.com, Mark Rotteveel <Avalanche1979@> wrote:
>
> >
> > I am unable to reproduce your problem. I used the following code in a
> > project that includes the Jaybird-2.1.6-full.jar:
> >
> > import java.sql.Connection;
> > import java.sql.SQLException;
> > import javax.sql.PooledConnection;
> > import org.firebirdsql.pool.FBConnectionPoolDataSource;
> >
> > public class JeanProblem {
> >
> > public static void main(String[] args) throws SQLException {
> > FBConnectionPoolDataSource dataSource = new
> > FBConnectionPoolDataSource();
> > dataSource.setMaxStatements(10);
> > dataSource.setMaxIdleTime(30 * 60 * 60);
> > dataSource.setPooling(true);
> > dataSource.setMaxPoolSize(5);
> > dataSource.setMinPoolSize(2);
> > dataSource.setLoginTimeout(10000);
> > dataSource.setDatabase("localhost:D:/data/db/TESTDB.FDB");
> > dataSource.setPassword("masterkey");
> > dataSource.setUserName("SYSDBA");
> > PooledConnection pooledConnection =
> > dataSource.getPooledConnection();
> > Connection connect = pooledConnection.getConnection();
> > }
> > }
> >
> > All I have done to get this to work in NetBeans (6.9) is:
> > 1) Add the Jaybird library to NetBeans:
> > - Tools, Libraries, Add new library
> > - Library Name: Jaybird-2.1.6
> > - Library Type: Class Libraries
> > - Ok
> > - On Tab Classpath, Add JAR/Folder
> > - Browse to the Jaybird-2.1.6-full.jar and select it
> > - Add JAR/Folder
> > - Ok
> > 2) Create a new project
> > - File, New Project
> > - Select Java, Java Application
> > - Next
> > - Fill in names for the project, location and main class
> > - Finish
> > 3) Add Jaybird library to the project
> > - In the Projects view, right-click on the 'Libraries' folder for the
> > new project
> > - Add Library
> > - Select 'Jaybird-2.1.6' library from the list
> > 4) Enter code
> > 5) Run: it works, no errors (except in the Firebird log as I don't close
> > the connection pool before the program ends ;)
> >
> > BTW: For normal applications you would normally use the
> > FBWrappingDataSource if you want connection pooling. You should not use
> > the FBConnectionPoolDataSource; FBConnectionPoolDataSource (and its
> > getPooledConnection()-method) are intended for managed environments like
> > JEE servers.
> >
> >
> > On 29-10-2010 15:49, Jean Noël Martin wrote:
> > > hello
> > > I can give you the source code of the high level usage of the connection to avoid misunderstatment
> > >
> > > if (!FBDriverLoaded) { // don't load Jaybird more than once.
> > > {
> > > try
> > > {
> > > Class.forName("org.firebirdsql.jdbc.FBDriver");
> > > org.firebirdsql.pool.FBConnectionPoolDataSource dataSource = new org.firebirdsql.pool.FBConnectionPoolDataSource();
> > > if( dataSource != null )
> > > {
> > > FBDriverLoaded = true;
> > > }
> > > dataSource.setMaxStatements( 10);
> > > dataSource.setMaxIdleTime( 30* 60 * 60);
> > > dataSource.setPooling(true);
> > > dataSource.setMaxPoolSize( 5);
> > > dataSource.setMinPoolSize( 2);
> > > dataSource.setLoginTimeout( 10000);
> > > dataSource.setDatabase ("localhost:E:\\Program Files\\Borland\\bin\\COHERENCE");
> > > dataSource.setPassword("masterkey");
> > > dataSource.setUserName("SYSDBA");
> > > PooledConnection pooledConnection = dataSource.getPooledConnection();
> > > connect = pooledConnection.getConnection();
> > > }
> > > catch (SQLException ex)
> > > {
> > > Logger.getLogger(JNMImportAction.class.getName()).log(Level.SEVERE, null, ex);
> > > }
> > > catch( IllegalArgumentException e)
> > > {
> > > e.printStackTrace();
> > > }
> > > if( cnx != null )
> > > {
> > > returnValue = true; }
> > > else
> > > {
> > > returnValue = false;
> > > }
> > > }
> > >
> > > --- In Firebird-Java@yahoogroups.com, Jean Noël Martin<jnm53@> wrote:
> > >>
> > >> hi
> > >> I checked step 1 and 2
> > >> 1 consist in tool library
> > >> 2 consist in Service Driver
> > >> The two are completed
> > >> however the result remain unusuable I go the IllegalArgumentException e = specified GDS Type null is unknown.
> > >>
> > >> --- In Firebird-Java@yahoogroups.com, "Mark Rotteveel"<Avalanche1979@> wrote:
> > >>>
> > >>>> Ok I read you;
> > >>>> However I use the source of Jaybird becausa NetBean don't recognize the
> > >>>> import instructions with only the Jar file....
> > >>>
> > >>> Then you really are doing something wrong in Netbeans. I think you simply forgot to add the library to your project. Step 1 is creating a user library for Jaybird in Netbeans (which I think you did), step 2 is adding that library to your current project (which I you forgot to do). After that imports should just work. There is never a good reason to need to include the source of a dependency into your own program.
> >
> > --
> > Mark Rotteveel
> >
>