改了用户名和密码
然后修改
//: DatabaseConnectTest.javaimport java.sql.* ;public class DatabaseConnectTest
{
public static void main ( String [] args )
{
Connection conn = DatabaseManager.getConnection ( ) ;
if ( conn == null )
{
System.out.println ( "Connection attempt was successful!" ) ;
try
{
conn.close ( ) ;
}
catch ( SQLException ex )
{
ex.printStackTrace ( ) ;
System.out.println ( "Problem closing the connection" ) ;
}
}
// 增加下面部分
else
{
System.out.println ( "Connected Failed!" ) ;
}
}
}结果输出Connected Failed!,也就是conn == null ;
然后修改
//: DatabaseConnectTest.javaimport java.sql.* ;public class DatabaseConnectTest
{
public static void main ( String [] args )
{
Connection conn = DatabaseManager.getConnection ( ) ;
if ( conn == null )
{
System.out.println ( "Connection attempt was successful!" ) ;
try
{
conn.close ( ) ;
}
catch ( SQLException ex )
{
ex.printStackTrace ( ) ;
System.out.println ( "Problem closing the connection" ) ;
}
}
// 增加下面部分
else
{
System.out.println ( "Connected Failed!" ) ;
}
}
}结果输出Connected Failed!,也就是conn == null ;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货