/*
* Created on 2004-4-2
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
import java.sql.*;
/**
* @author XXXXXXX
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class DbConnection{
private static Connection conn;
public static Connection getConn()
throws ClassNotFoundException, SQLException{
if (conn == null) {
String strurl="jdbc:odbc:JspData";
//为你在系统DNS里设置的数据库!
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection(strurl,"loginName","loginPwd") ; //<------********
}
return conn;
}
public static void closeConnection() throws SQLException {
conn.close();
}
}
* Created on 2004-4-2
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
import java.sql.*;
/**
* @author XXXXXXX
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class DbConnection{
private static Connection conn;
public static Connection getConn()
throws ClassNotFoundException, SQLException{
if (conn == null) {
String strurl="jdbc:odbc:JspData";
//为你在系统DNS里设置的数据库!
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
conn=DriverManager.getConnection(strurl,"loginName","loginPwd") ; //<------********
}
return conn;
}
public static void closeConnection() throws SQLException {
conn.close();
}
}
回复Comments
{commenttime}{commentauthor}
{CommentUrl}
{commentcontent}