Did one weeks, finally put the credit card management system finished, the mood is very good, now want to go back to experience the whole process:
Difficulties:
1. Configuring JDBC in Jbuiler
2.server 2000 due to no SP4 patch, 1433 port is turned off, causing the connection database to not be on
Solution:
error when creating data library connections:
"Java.lang.ClassNotFoundException:com.microsoft.jdbc.sqlserver.SQLServerDriver"
A: Check the following steps:
1. Whether the installation of the data library drivers is in accordance with the normal procedures. There is no error message in the installation.
2. Whether the CLASSPATH environment variable is required to join the data library driver. jar files (MSUTIL.JSR, Msbase.jar, Mssqlserver.jar).
3. Copy the required. jar file for the data library driver to the JDK's jre/lib/ext/. If it is a jsp/servlet program, please copy the library driver's required. jar file to the Web server's Lib catalogue, for example: Copy to Tomcat's common/lib/(Tomcat needs to be restarted).
4. Reboot or reactivate the Web server.
Java code public class Cardconnect to connect to the SQL Server database ... {
private static Cardconnect dbconn=new cardconnect ();
Public Cardconnect () ... {
Try ... {
Class.forName ("Com.microsoft.jdbc.sqlserver.SQLServerDriver");
}catch (classnotfoundexception ee) ... {
}
}
public static Connection Getconn () throws SQLException ... {
String url = "Jdbc:microsoft:sqlserver://localhost:1433;databasename=card_account";
String username= "SA";
String password= "Test";
Return drivermanager.getconnection (Url,username,password);
}
public static void Close (ResultSet rs) ... {
Try ... {
Rs.close ();
}
catch (Exception ex) ... {
}
}
public static void Close (Statement stmt) ... {
Try ... {
Stmt.close ();
}
catch (Exception ex) ... {
}
}
public static void Close (Connection conn) ... {
Try ... {
Conn.close ();
}
catch (Exception ex) ... {
}
}
}