users
[Top] [All Lists]

Re: [cinjug-users] Help: JDBC connection for WIndows CE embedded Java de

To: <users@xxxxxxxxxx>
Subject: Re: [cinjug-users] Help: JDBC connection for WIndows CE embedded Java device fails
From: "Kevin Finley" <kevin.finley@xxxxxxxxx>
Date: Mon, 28 Jun 2004 12:02:51 -0400
Delivered-to: mailing list users@cinjug.org
Mailing-list: contact users-help@cinjug.org; run by ezmlm
References: <BAY22-F40vnkFQRFg3C00015a43@hotmail.com> <005c01c45d28$070f1340$6701a8c0@HORATI02>
A semi-important typo correction.

----- Original Message ----- 
From: "Kevin Finley" <kevin.finley@xxxxxxxxx>
To: "Manisha Kode" <mkkode@xxxxxxxxxxx>; <users@xxxxxxxxxx>
Sent: Monday, June 28, 2004 11:53 AM
Subject: Re: [cinjug-users] Help: JDBC connection for WIndows CE embedded
Java device fails


> This is probably too late for your demo, but maybe this can help someone
> else.
>
> If those are your only grant statements, then you haven't given permission
> to connect to the network.  It's certainly possible (and, without
reviewing
> those details of the spec, I believe in violation of the JDBC spec) that a
> driver would report that it cannot handle a connection URL if it cannot
> access the network at all.
>
> A few things to note about the way you loaded the driver.  You are
> specifically not supposed to call new Driver(...), Driver.newInstance(),
or
> DriverManager.registerInstance().  Those methods are made public for the
> exclusive use of the DriverManager and Driver implementations.  By spec,
> Driver implementations are required to call
DriverManager.registerInstance()
> in a static initializer.  I don't actually recall if that instance has to
be
> fully realized or if it can be some kind of hollow instance.  Other than
> performance, it should make no difference; i.e., when do you pay the
> overhead for the necessary housekeeping as opposed to do you need to pay
for
> it.
>
> As far as using Class.forName( "driver" ), all you have proven is that the
> given class can be found, not that is claims to handle the connection URL
> that you provided and not that it has been registered with the
DriverManager
> correctly.  You should try calling DriverManager.getDriver(
connectionUrl )
> to see if that driver is actually telling the DriverManager that it can
> handle URLs of the type "jdbc:oracle:thin:..."
>
> As a side note, specifying
>     -Djdbc.drivers=com.foo.driver1:com.foo.driver2 (where : is your
> system-specific class separator)

where : is your system-specific PATH separator.  Regardless that the docs
say use ":", I know I remember problems when I didn't use ";" on Windows.

> is preferred to using
>     Class.forName( "com.foo.driver1" ) inside code.
>
> For more information, see
>
http://java.sun.com/j2se/1.4.2/docs/guide/jdbc/getstart/drivermanager.html#998348
>
> All the above details regarding use of DriverManager aside, don't forget
> about javax.sql.DataSource ;-)
>
> Hope this helps,
> Kevin
>
>
> ----- Original Message ----- 
> From: "Manisha Kode" <mkkode@xxxxxxxxxxx>
> To: <users@xxxxxxxxxx>
> Sent: Friday, June 25, 2004 2:52 PM
> Subject: [cinjug-users] Help: JDBC connection for WIndows CE embedded Java
> device fails
>
>
> > Hello All,
> >
> > I am sure everyone is ready for weekend... I have to fix this problem to
> > demo the application on Monday at client site... I know its crazy... Any
> and
> > all help is really appreciated... I have exhausted all my resources..
You
> > guys are the last and only hope...
> >
> > I have an applet which makes a JDBC connection to the database which is
> > residing on the same server as the web server
> >
> > This applet works fine from the server and remote client which has
windows
> > 2000 OS.
> >
> > I am testing the same applet from a device which has WIndows CE .Net
with
> > CrEme JVM
> >
> > The applet comes up.. but gets an error "No Suitable Driver "  in
> > getConnection method while trying to establish the DB connection.
> >
> > Changing the driver class file gives me an error class not found.. SO i
am
> > sure that the driver class is found
> >
> > I have tried all the different URL connection strings given on the
oracle
> > FAQ site as well as in any message on the web.. All those strings work
on
> > the server with windows 2000...but do not work on the windows CE device
> >
> > Do I need to change any settings of the DB on the server to allow CE
> devices
> > to connect to DB?
> > I have taken care of the security permissions needed for this in
> java.policy
> > file ..
> > grant {
> >        permission java.util.PropertyPermission
> > "oracle.jdbc.J2EE13Compliant", "read";
> >        permission java.util.PropertyPermission "oracle.jserver.version",
> > "read";
> >      }
> >
> >
> > Below is the code..  the commented statements can be used and they
work..
> >
> >            try {
> >              DriverManager.registerDriver(new
> > oracle.jdbc.driver.OracleDriver());
> > //Class.forName ("oracle.jdbc.driver.OracleDriver").newInstance();
> >   System.out.println("Registred the driver");
> > //            con =
> >
>
DriverManager.getConnection("jdbc:oracle:thin:@//b2d-devserver:1521/b2d9isvr
> b2dsolutions.com","b2d3","b2d2003");
> > con = DriverManager.getConnection
> > ("jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS
> > =(HOST=b2d-devserver)(PROTOCOL=TCP)(PORT = 1521))(CONNECT_DATA
> > =(service_name=b2d9isvr.b2dsolutions.com)))","b2d3","b2d2003");
> >              empValues.setText("Connected to the Database. Fetching
Values
> > from PLANT Table.\n");
> >              fetchValues();
> >            } catch (SQLException ex)     {
> >              System.out.println("Connection Error =  "  +
ex.toString());
> >      ex.printStackTrace();
> >            }
> > catch (Exception E) {
> > System.err.println("Unable to load JDBC driver.");
> > E.printStackTrace();
> > }
> > ------------------------------------------
> >
> > I really appreciate any suggestions.
> >
> > Thanks,
> > Manisha.
> >
> > _________________________________________________________________
> > MSN Movies - Trailers, showtimes, DVD's, and the latest news from
> Hollywood!
> > http://movies.msn.click-url.com/go/onm00200509ave/direct/01/
> >
> >
> > ---------
> > You may unsubscribe from this mailing list
> > by sending a blank email addressed to:
> > users-unsubscribe@xxxxxxxxxx
> >
> > --
> > Find additional help by sending a blank email
> > addressed to:
> > users-help@xxxxxxxxxx
> >
> >
>
>
>
> ---------
> You may unsubscribe from this mailing list
> by sending a blank email addressed to:
> users-unsubscribe@xxxxxxxxxx
>
> --
> Find additional help by sending a blank email
> addressed to:
> users-help@xxxxxxxxxx
>
>



<Prev in Thread] Current Thread [Next in Thread>