Article View: borland.public.jbuilder.java.language
Article #15347Re: JDBC Driver
From: Tom Eng
Date: Fri, 18 Jun 1999 00:00
Date: Fri, 18 Jun 1999 00:00
61 lines
3270 bytes
3270 bytes
You can't use the jdbc-odbc bridge the way you proposed from an applet. Use
a servlet or a middleware proxy server.
Donald Munro wrote in message <7kas0c$kik$1@hermes.is.co.za>...
>
>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;
>> }
>>
>I had the same problem trying to use the JDBC/ODBC bridge using their
>tutorial code. The following seems to work better :
>
>try
> { Driver jdbcDriver =
(Driver)Class.forName(jdbcClassName).newInstance();
> if (jdbcDriver != null)
> { Properties info = new Properties();
> m_Connection = jdbcDriver.connect(connectionString,info);
> }
> }
> catch (ClassNotFoundException e)
> { System.err.println("FATAL ERROR : Failed to obtain jdbc class " +
>jdbcClassName + "\n" + e.getMessage());
> e.printStackTrace();
> return false;
> }
> catch (InstantiationException e)
> { System.err.println("FATAL ERROR : Failed to obtain jdbc class " +
>jdbcClassName + "\n" + e.getMessage());
> e.printStackTrace();
> return false;
> }
> catch (SQLException e)
> { System.err.println("FATAL ERROR : Failed to obtain jdbc connection " +
>connectionString + "\n" + e.getMessage());
> e.printStackTrace();
> return false;
> }
> catch (IllegalAccessException e)
> { System.err.println("FATAL ERROR : Failed to obtain jdbc connection " +
>connectionString + "\n" + e.getMessage());
> e.printStackTrace();
> return false;
> }
> return true;
>
>Hope this helps,
>Donald Munro (donaldm@tricom.co.za)
>
>
Technical Details
Message-ID:
<7kejmv$as2$1@oak.prod.itd.earthlink.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<7k8ch6$j8u$1@mailint03.im.hou.compaq.com> <7kas0c$kik$1@hermes.is.co.za>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa45f,4a2d57c24fdb42a9 X-Google-Attributes: gidfa45f,public X-Google-Thread: f5d71,4a2d57c24fdb42a9 X-Google-Attributes: gidf5d71,public X-Google-Thread: fecd1,4a2d57c24fdb42a9 X-Google-Attributes: gidfecd1,public X-Google-Thread: 115d3b,4a2d57c24fdb42a9 X-Google-Attributes: gid115d3b,public X-Google-Thread: f74b3,4a2d57c24fdb42a9 X-Google-Attributes: gidf74b3,public X-Google-Thread: 113ae9,1b231ae46583c0cb X-Google-Attributes: gid113ae9,public X-Google-Thread: 111d6b,4a2d57c24fdb42a9 X-Google-Attributes: gid111d6b,public X-Google-Thread: 10bb9b,4a2d57c24fdb42a9 X-Google-Attributes: gid10bb9b,public From: "Tom Eng" <tf49665@earthlink.net> Subject: Re: JDBC Driver Date: 1999/06/18 Message-ID: <7kejmv$as2$1@oak.prod.itd.earthlink.net> X-Deja-AN: 491649332 References: <7k8ch6$j8u$1@mailint03.im.hou.compaq.com> <7kas0c$kik$1@hermes.is.co.za> X-Posted-Path-Was: not-for-mail X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 X-ELN-Date: 18 Jun 1999 23:11:27 GMT X-ELN-Insert-Date: Fri Jun 18 16:15:17 1999 Organization: EarthLink Network, Inc. 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