自學考試互聯網數據庫1-11章問答資料(7)
{
public static void main(String argv[])
{
if(argv.length==0)
{
System.err.println(“檢查到空的URL!”); System.exit(1);
}∥end of if
try
{
Class.forName(“textFileDriver”);
Class.forName(“jdbc.odbc.JdbcOdbcDriver”);
Class.forName(“imaginary.sq1.iMsq1Driver”);
String ur1=argv[0];
String user,pwd;
If(argv.length>1)
{
user=argv[1];
}
else
{
user=”” }
If(argv.length>2)
{
pwd=argv[2];
}
else
{
pwd=”” }
Connection con=DriverManager.getConnectiion(ur1,user,pwd);
Con.close();
System.out.println(“連接失敗!”); }∥end of try
∥処理連接異常 catch(Exception e)
{
0條評論