//Initialize and load the JDBC-ODBC driver
try
{
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver");
try
{
//Make the connection object
Connection conURL =
DriverManager.getConnection("jdbc:odbc:myDSN;uid=\"\";pw=\"\"");
....
....
}
catch(SQLException e)
{
txtErrorMessage.setText("SQL Exception caught from getConnection : " +
e.getMessage());
}
}
catch(ClassNotFoundException e)
{
txtErrorMessage.setText( "Class not found Exception caught : " +
e.getMessage());
}
Martin Turner <Martin...@compuserve.com> wrote in article
<uOl9Ihx...@nih2naaa.prod2.compuserve.com>...
When I used JDBC to access the MS-Access database from withing my
application it worked fine. But I converted my application to an applet and
started using RMI to get to the server. There it fails with the same error
msg, no suitable driver found.
Here is the mail I sent in RMI-USERS mailing list and its response. it may
be useful to understand the problem.
ANy body with some ideas please????
----------------------------------------------------------------------------
-------------------------------------------------------------------------
Yes. I have created a system DSN. But still it gives the same problem. It
says No Suitable Driver found. Is it something to do with JDBC-ODBC bridge?
or should I load some other drivers?
I heard there are RMIJDBC drivers available. Will it be useful in my case?
Thanks for the help.
-----Original Message-----
From: andreas....@madplanet.ch [mailto:andreas....@madplanet.ch]
Sent: Tuesday, September 29, 1998 2:56 AM
To: Varanasi, Sastry
Subject: RE: RMI - JDBC problem
Hi
Did you create the DSN as system DSN ? (Do not create it as User DSN).
Bye-bye
Andreas Schäfer
-----Original Message-----
From: Varanasi, Sastry [SMTP:sastry....@COMPAQ.COM]
Sent: Tuesday, September 29, 1998 11:04 AM
To: RMI-...@JAVA.SUN.COM
Subject: RMI - JDBC problem
Hi All,
I have an MS-Access data source configured in ODBC which I was using in my
application thru JDBC-ODBC bridge, without rmi. But now when I use RMI to
supply data to my applet the server says there is no such driver. Can some
one please take a look at this and let me know what is going wrong?
RMI Server has the following piece of code.
String dsn = "jdbc:odbc:Test";
String user = "admin";
String password = "***";
Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
con = DriverManager.getConnection(dsn, user, password);
Here it fails with an SQLException - No suitable driver.
The same lines work very well if I use this without rmi.
I need to get this problem resolved immediately as I am heading for a
release. Please help!!!
Sastry.
===========================================================================
To unsubscribe, send email to list...@java.sun.com and include in the body
of the message "signoff RMI-USERS". For general help, send email to
list...@java.sun.com and include in the body of the message "help".
For a list of frequently asked RMI questions please refer to:
http://java.sun.com/products/jdk/rmi/faq.html
To view past RMI-USERS postings, please see:
http://java.sun.com/products/jdk/rmi/archives/index.html
Dave Harter wrote in message <01bdeb53$2cff8c80$af72e8c7@0330dharter02>...
Hi,
If you already use RMI, why don't you move the database calls to the
server? I used an applet which called methodes of a server application.
This application loaded the driver, connected to the DB and sent all SQL
Statements against the DB. This worked fine with JDBC-ODBC bridge.
I always thought JDBC-ODBC bridge is not allowed with applets because it
requires ODBC code loaded at the client.
mfg, Georg
1. IE4 will *not* accept the Sun version of the JDBC-ODBC bridge in any
case. You need to use the MS version (com.ms. ... rather than sun. ...). All
other Java enviroments (except J++ of course) wil *not* work with com.ms.
...
*** A big "thank you" to William III Gates for this great design decision in
the MS Java VM. ***
2. The bridge will *not* work in an applet unless
- the client running the applet has same OS as the bridge version requires
(usually Win95 or WIN NT)
- the applet has privilege to access local native code (essentially if you
run locally on the development machine)
- an ODBC data source matching the name in the URL is available on the
*client machine* (it will not do to have it on the web server)
This is why for all practical purposes the bridge is *not* suitable for
applets, notably not for those intended for internet use.
*** A big "thank you" to Sun for this one, Applet security is really helpful
***
So if you want to use JDBC in an applet
-either use a type 3 or type 4 JDBC driver in the applet (not recommended)
- or a decent database middleware + a three tier architecture (recommended)
Now why is JDBC in an applet not recommended:
1. from applets any TCP/IP connection is restricted to the web server, so
you need to run your database on the web server to make this work (credits:
Sun Microsystems)
2. many JDBC drivers use their own TCP/IP ports other than well-known ports
for comms. Therefore they cannot connect thru most corporate firewalls.
3. most JDBC drivers require JDK1.1 or better which is not available in IE3,
Netscape < 4.05, ...
If you use a DB middleware, therefore, it is essential to avoid these two
pitfalls. I have come to the conclusion it is best to write one myself based
on http protocol.
Hope this helps
Andreas
Martin Turner wrote in message ...
Try:
Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
And.. why passing user and password in the URL in getConnection ?
there's a getConnection(url, user, passwd) method.
Regards,
Pierre-Yves Gibello :)
For IE 4 you will need to use the MS bridge driver...
Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver")
Good Luck,
Ken Sellers
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum