package com.chinacountry.databases;
import Java.sql.*;
import Java.util.StringTokenizer;
public class connDB
{
String sDBDriver = "org.gjt.mm.MySQL.Driver";
String sConnStr = "jdbc:MySQL://10.100.27.13:3306/db1";
Connection cn = null;
Statement stmt;
boolean autoCommit;
private String DbType="MySQL";
//private String DbType="Oracle";
private connDB()
{
init();
}
private void init()
{
try
{
Class.forName(sDBDriver).newInstance();
cn = DriverManager.getConnection(sConnStr,"naxweb","naxweb");
}
catch(Exception e)
{
System.err.println("conndb(): " + e.getMessage());
}
}
public static connDB getNewInstance()
{
return new connDB();
}
//數據綁定的資料好像很少,有空給大家一個例子。在這裡只能返回PreparedStatement。
public PreparedStatement getPreparedStmt(String sql) throws SQLException
{
PreparedStatement preStmt=null;
try
{
&nbs