Re: JDBC driver conflict with "System.in.read();"?????????????



Thanks for your help!
I do it as you,there are no problem too.So i realize what is the reason
suddenly,i start the application in IDE not the command line when it goes
wrong. I use Eclipse platform as my java IDE,this maybe the bug of Eclipse.

"joeNOSPAM@xxxxxxx" wrote:

> Hi. I am not sure what's wrong, but I tried to duplicate your problem
> with a simple single program, and couldn't.
>
> Joe Weinstein at BEA Systems
>
> /*
> when I run this, I get:
>
> C:\new_ms_driver>java foo
> begin
> input?
> DBThread started
> Driver version is 1.0.107.104
> Database Major version is 8
> Database Minor version is 0
> DBThread done
> (I type in something now)
> */
>
> import java.sql.*;
> import java.util.*;
>
> public class foo
> {
> public static void main(String args[])
> throws Exception
> {
> try{
> System.out.println("begin");
> DBThread dt = new DBThread();
> dt.start();
> System.out.println("input?");
> System.in.read();
> }catch(Exception ex){
> ex.printStackTrace();
> }
> }
> }
>
> class DBThread extends Thread{
> public void run(){
> Connection c = null;
> try
> {
> System.out.println("DBThread started");
> Properties props = new Properties();
> Driver d = new
> com.microsoft.sqlserver.jdbc.SQLServerDriver();
>
> props.put("user", "joe");
> props.put("password", "joe");
>
> c = d.connect("jdbc:sqlserver://joe:1433", props );
>
> DatabaseMetaData dd = c.getMetaData();
> System.out.println("Driver version is " +
> dd.getDriverVersion() );
> System.out.println("Database Major version is " +
> dd.getDatabaseMajorVersion() );
> System.out.println("Database Minor version is " +
> dd.getDatabaseMinorVersion() );
> }
> catch (Exception ouch)
> {
> System.out.println("ouch: " + ouch );
> }
> System.out.println("DBThread done");
> }
> }
>
>
.


Loading