import java.net.*;
import java.sql.*;
import java.lang.*;/**
* Title: Five Chess
* Description:
* Copyright: Copyright (c) 2001
* Company: neusoft
* @author xuguoping
* @version 1.0
*/public class jdbc_connect
{ public static void main(String argv[])
{
if(argv.length==0)
{
System.err.println("Usage:");
System.err.println("");
System.err.println("java jdbc_connect URL");
System.exit(1); }
else{
System.out.println("Error!!");
} try{
Class.forName("textFileDriver");
Class.forName("jdbc.odbc.JdbcOdbcDriver");
Class.forName("imaginary.sql.iMsqDriver"); String myurl=argv[0]; //<-----------delete new
String user,pwd; if(argv.length>1)
{
user=argv[1];
}
else
{
user="";
}
if(argv.length>2)
{
pwd=argv[2];
}
else
{
pwd="";
} Connection con=DriverManager.getConnection(myurl,user,pwd);
con.close();
System.out.println("Connection successful!");
}
catch(Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
}}
import java.sql.*;
import java.lang.*;/**
* Title: Five Chess
* Description:
* Copyright: Copyright (c) 2001
* Company: neusoft
* @author xuguoping
* @version 1.0
*/public class jdbc_connect
{ public static void main(String argv[])
{
if(argv.length==0)
{
System.err.println("Usage:");
System.err.println("");
System.err.println("java jdbc_connect URL");
System.exit(1); }
else{
System.out.println("Error!!");
} try{
Class.forName("textFileDriver");
Class.forName("jdbc.odbc.JdbcOdbcDriver");
Class.forName("imaginary.sql.iMsqDriver"); String myurl=argv[0]; //<-----------delete new
String user,pwd; if(argv.length>1)
{
user=argv[1];
}
else
{
user="";
}
if(argv.length>2)
{
pwd=argv[2];
}
else
{
pwd="";
} Connection con=DriverManager.getConnection(myurl,user,pwd);
con.close();
System.out.println("Connection successful!");
}
catch(Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
}}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货