一聚教程网:一个值得你收藏的教程网站

热门教程

果果来看(一个封装了基本JDBC操作的类)

时间:2022-11-14 23:26:39 编辑:袖梨 来源:一聚教程网

odbc.java
---------------------------------------------
package bbs;
/*
database operation class, test by odbc
This javabean is written by zergling
It is my first javabean :o
version 1.01
*/
import java.sql.*;
import java.lang.*;
import java.io.*;
import java.util.*;
import sun.io.*;
public class odbc
{
Connection sqlCon;
ResultSet rstSql;
Statement stmS;
String strCon;
String strSql;
boolean status;
long rowcount;
int page;
int pagesize;
long pagecount;
long firstrecord;
//connect to the default database
public boolean connect()
{
//Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
this.strCon = "jdbc:odbc:jspbbs"; //replace with your default database
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
this.sqlCon = java.sql.DriverManager.getConnection(this.strCon,"sa",""); //replace with your default database connection configure option

热门栏目