Article View: borland.public.jbuilder.java.language
Article #15356Re: JDBC Driver
From: William Yuen
Date: Mon, 21 Jun 1999 00:00
Date: Mon, 21 Jun 1999 00:00
43 lines
2620 bytes
2620 bytes
It is because Microsoft and Sun use a different ODBC driver.
It may help :
try {
if (System.getProperty("java.vendor").startsWith("Microsoft"))
Class.forName("com.ms.jdbc.odbc.JdbcOdbcDriver");
else
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (Exception e) {
System.out.println("Failed to load JDBC/ODBC driver.");
return;
}
Niu Jimin <jmniu@bj.china.com> wrote in message
news:7kabq7$gts$1@info.bta.net.cn...
> What environment are you using? One hour ago, I met the same problem as
you,
> but I have overcome it. I also use the example provided in Java Tutor, but
> it is an application, not an applet. When I use Visual J++ 6.0 , I got the
> same compiling error as you, but when I compiled it using JDK1.2.2(command
> line), it can run OK. So maybe you need another Java Environment.
>
> MJR <Rao.Mohith@compaq.com> wrote in message
> news:7k8ch6$j8u$1@mailint03.im.hou.compaq.com...
> > Does anyone know why the following code throws an exception (I got the
> code
> > straight off the java.sun.com tutorial on JDBC)?
> >
> > try {
> > Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
> > }
> > catch( Exception e ) {
> > System.err.println( "Failed to load JDBC/ODBC driver." );
> > return;
> > }
> >
> >
> >
>
>
Technical Details
Message-ID:
<7kkana$32r3@news.hk.linkage.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7k8ch6$j8u$1@mailint03.im.hou.compaq.com> <7kabq7$gts$1@info.bta.net.cn>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5d71,4a2d57c24fdb42a9 X-Google-Attributes: gidf5d71,public X-Google-Thread: fa45f,4a2d57c24fdb42a9 X-Google-Attributes: gidfa45f,public X-Google-Thread: 113ae9,1b231ae46583c0cb X-Google-Attributes: gid113ae9,public X-Google-Thread: f74b3,4a2d57c24fdb42a9 X-Google-Attributes: gidf74b3,public X-Google-Thread: 111d6b,4a2d57c24fdb42a9 X-Google-Attributes: gid111d6b,public X-Google-Thread: 10bb9b,4a2d57c24fdb42a9 X-Google-Attributes: gid10bb9b,public X-Google-Thread: fecd1,4a2d57c24fdb42a9 X-Google-Attributes: gidfecd1,public X-Google-Thread: 115d3b,4a2d57c24fdb42a9 X-Google-Attributes: gid115d3b,public From: "William Yuen" <hkjavaman@hotmail.com> Subject: Re: JDBC Driver Date: 1999/06/21 Message-ID: <7kkana$32r3@news.hk.linkage.net> X-Deja-AN: 491950752 References: <7k8ch6$j8u$1@mailint03.im.hou.compaq.com> <7kabq7$gts$1@info.bta.net.cn> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 Organization: Linkage Online Ltd. X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.language,comp.lang.java,comp.lang.java.api,comp.lang.java.help,comp.lang.java.machine,comp.lang.java.misc,comp.lang.java.security,microsoft.public.inetexplorer.ie4.java_applets