c連接mysql資料庫
里的大部分代碼參考了MySQL發行包裡面的.c源文件,大家也可以去裡面找找相關的代碼,下面這段代碼實現了連接到本地MySQL伺服器上9tmd_bbs_utf8資料庫,從數據表tbb_user中根據輸入的userid取得該用戶的用戶名並列印輸出到終端。
if defined(_WIN32) || defined(_WIN64)為了支持windows平台上的編譯
#include <windows.h> #endif #include <stdio.h> #include <stdlib.h> #include "mysql.h"
我的機器上該文件在/usr/local/include/mysql下
定義MySQL資料庫操作的宏,也可以不定義留著後面直接寫進代碼
define SELECT_QUERY "select username from tbb_user where userid = %d" int main(int argc, char **argv)char **argv 相當於 char *argv[] {
MYSQL mysql,*sock;定義資料庫連接的句柄,它被用於幾乎所有的MySQL函數
MYSQL_RES *res;查詢結果集,結構類型
MYSQL_FIELD *fd ;包含欄位信息的結構
MYSQL_ROW row ;存放一行查詢結果的字元串數組
char qbuf[160];存放查詢sql語句字元串
if (argc != 2) { //檢查輸入參數 fprintf(stderr,"usage : mysql_select <userid>\n\n"); exit(1); } mysql_init(&mysql); if (!(sock = mysql_real_connect(&mysql,"localhost","dbuser","dbpwd","9tmd_bbs_utf8",0,NULL,0))) { fprintf(stderr,"Couldn't connect to engine!\n%s\n\n",mysql_error(&mysql)); perror(""); exit(1); } sprintf(qbuf,SELECT_QUERY,atoi(argv[1])); if(mysql_query(sock,qbuf)) { fprintf(stderr,"Query failed (%s)\n",mysql_error(sock)); exit(1); } if (!(res=mysql_store_result(sock))) { fprintf(stderr,"Couldn't get result from %s\n", mysql_error(sock)); exit(1); } printf("number of fields returned: %d\n",mysql_num_fields(res)); while (row = mysql_fetch_row(res)) { printf("Ther userid #%d 's username is: %s\n", atoi(argv[1]),(((row[0]==NULL)&&(!strlen(row[0]))) ? "NULL" : row[0])) ; puts( "query ok !\n" ) ; } mysql_free_result(res); mysql_close(sock); exit(0); return 0;
為了兼容大部分的編譯器加入此行
}
編譯的時候,使用下面的命令
gcc -o mysql_select ./mysql_select.c -I/usr/local/include/mysql -L/usr/local/lib/mysql -lmysqlclient (-lz) (-lm) 後面兩個選項可選,根據您的環境情況運行的時候,執行下面的命令
./mysql_select 1
將返回如下結果:
number of fields returned: 1 Ther userid #1 's username is: Michael query ok !
上面的代碼我想大部分都能看明白,不明白的可以參考一下MySQL提供的有關C語言API部分文檔,各個函數都有詳細說明,有時間我整理一份常用的API說明出來。
B. 如何用C語言連接MYSQL資料庫
1、配置ODBC數據源。
2、使用SQL函數進行連接。
對於1、配置數據源,配置完以後就可以編程操作資料庫了。
對於2、使用SQL函數進行連接,參考代碼如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include<windows.h>
#include<sql.h>
#include<sqlext.h>
void
main()
{
HENV
henv;
//環境句柄
HDBC
hdbc;
//數據源句柄
HSTMT
hstmt;
//執行語句句柄
unsigned
char
datasource[]="數據源名稱";
//即源中設置的源名稱
unsigned
char
user[]=
"用戶名";
//資料庫的帳戶名
unsigned
char
pwd[]=
"密碼";
//資料庫的密碼
unsigned
char
search[]="select
xm
from
stu
where
xh=0";
SQLRETURN
retcode;
//記錄各SQL函數的返回情況
//
分配環境句柄
retcode=
SQLAllocEnv(&henv);
//
等介於
SQLAllocHandle(SQL_HANDLE_ENV,
SQL_NULL
,
&henv);
//
設置ODBC環境版本號為3.0
retcode=
SQLSetEnvAttr(henv,
SQL_ATTR_ODBC_VERSION,
(void*)SQL_OV_ODBC3,
0);
//
分配連接句柄
retcode=
SQLAllocConnect(henv,&hdbc);
//
等介於
SQLAllocHandle(SQL_HANDLE_DBC,
henv,
&hdbc);
//設置連接屬性,登錄超時為*rgbValue秒(可以沒有)
//
SQLSetConnectAttr(hdbc,
SQL_LOGIN_TIMEOUT,
(SQLPOINTER)(rgbValue),
0);
//直接連接數據源
//
如果是windows身份驗證,第二、三參數可以是
C. 用C語言怎麼實現與資料庫的連接
#include<mysql/mysql.h>
#include<stdio.h>
intmain()
{
MYSQL*conn;
MYSQL_RES*res;
MYSQL_ROWrow;
char*server="localhost";//本地連接
char*user="root";//
char*password="525215980";//mysql密碼
char*database="student";//資料庫名
char*query="select*fromclass";//需要查詢的語句
intt,r;
conn=mysql_init(NULL);
if(!mysql_real_connect(conn,server,user,password,database,0,NULL,0))
{
printf("Errorconnectingtodatabase:%s ",mysql_error(conn));
}else{
printf("Connected... ");
}
t=mysql_query(conn,query);
if(t)
{
printf("Errormakingquery:%s ",mysql_error(conn));
}else{
printf("Querymade... ");
res=mysql_use_result(conn);
if(res)
{
while((row=mysql_fetch_row(res))!=NULL)
{
//printf("num=%d ",mysql_num_fields(res));//列數
for(t=0;t<mysql_num_fields(res);t++)
printf("%8s",row[t]);
printf(" ");
}
}
mysql_free_result(res);
}
mysql_close(conn);
return0;
}
(3)c連接mysql資料庫擴展閱讀
C語言使用注意事項:
1、指針是c語言的靈魂,一定要靈活的使用它:
(1)、指針的聲明,創建,賦值,銷毀等
(2)、指針的類型轉換,傳參,回調等
2、遞歸調用也會經常用到:
(1)、遞歸遍歷樹結構
(2)、遞歸搜索
D. Linux下C連接MySQL資料庫錯
skipping incompatible /usr/lib/mysql/libmysqlclient_r.a 這里是說這個庫文件與當前系統的編譯器gcc不一致,你需要確認一下是不是機器位數的問題
gcc -m32 -o test test.c `mysql_config --cflags --libs` 這樣試試
E. C#連接mysql資料庫如何實現多條件查詢
給你一個稍微復雜一點的查詢,我設計的
F. c語言怎麼連接mysql資料庫 代碼
//vc工具中添加E:\WAMP\BIN\MYSQL\MYSQL5.5.8\LIB 路徑
//在工程設置-》鏈接》庫模塊中添加 libmysql.lib
#include <stdio.h>
#include <time.h>
#include <string.h>
#include <winsock.h>
#include "E:\wamp\bin\mysql\mysql5.5.8\include\mysql.h"
void main(){
MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;
char *server ="localhost";
char *user ="root";
char *password="";
char *database="test";
char sql[1024]="select * from chinaren";
conn=mysql_init(NULL);
if(!mysql_real_connect(conn,server,user,password,database,0,NULL,0)){
fprintf(stderr,"%s\n",mysql_error(conn));
exit(1);
}
if(mysql_query(conn,sql)){
fprintf(stderr,"%s\n",mysql_error(conn));
exit(1);
}
res=mysql_use_result(conn);
while((row = mysql_fetch_row(res))!=NULL){
printf("%s\n",row[2]);
}
mysql_free_result(res);
mysql_close(conn);
}
===============================
#if defined(_WIN32) || defined(_WIN64) //為了支持windows平台上的編譯
#include <windows.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include "mysql.h"
//定義資料庫操作的宏,也可以不定義留著後面直接寫進代碼
#define SELECT_QUERY "show tables;"
int main(int argc, char **argv) //char **argv 相當於 char *argv[]
{
MYSQL mysql,*handle; //定義資料庫連接的句柄,它被用於幾乎所有的MySQL函數
MYSQL_RES *result; //查詢結果集,結構類型
MYSQL_FIELD *field ; //包含欄位信息的結構
MYSQL_ROW row ; //存放一行查詢結果的字元串數組
char querysql[160]; //存放查詢sql語句字元串
//初始化
mysql_init(&mysql);
//連接資料庫
if (!(handle = mysql_real_connect(&mysql,"localhost","user","pwd","dbname",0,NULL,0))) {
fprintf(stderr,"Couldn't connect to engine!\n%s\n\n",mysql_error(&mysql));
}
sprintf(querysql,SELECT_QUERY,atoi(argv[1]));
//查詢資料庫
if(mysql_query(handle,querysql)) {
fprintf(stderr,"Query failed (%s)\n",mysql_error(handle));
}
//存儲結果集
if (!(result=mysql_store_result(handle))) {
fprintf(stderr,"Couldn't get result from %s\n", mysql_error(handle));
}
printf("number of fields returned: %d\n",mysql_num_fields(result));
//讀取結果集的內容
while (row = mysql_fetch_row(result)) {
printf("table: %s\n",(((row[0]==NULL)&&(!strlen(row[0]))) ? "NULL" : row[0]) ) ;
}
//釋放結果集
mysql_free_result(result);
//關閉資料庫連接
mysql_close(handle);
system("PAUSE");
//為了兼容大部分的編譯器加入此行
return 0;
}
G. 用C#.net連接MYSQL,怎麼連接還要安裝什麼嗎急!!!
連接MYSQL資料庫的方法及示例
方法一:
使用MYSQL推出的MySQL
Connector/Net
is
an
ADO.NET
driver
for
MySQL
該組件為MYSQL為ADO.NET訪問MYSQL資料庫設計的.NET訪問組件。
安裝完成該組件後,引用命名空間MySql.Data.MySqlClient;
使用命令行編譯時:csc
/r:MySql.Data.dll
test.cs
方法二:
通過ODBC訪問MYSQL資料庫
訪問前要先下載兩個組件:odbc.net和MYSQL的ODBC驅動(MySQL
Connector/ODBC
(MyODBC)
driver)目前為3.51版
安裝完成後,即可通過ODBC訪問MYSQL資料庫
方法三:
使用CoreLab推出的MYSQL訪問組件,面向.NET
安裝完成後,引用命名空間:CoreLab.MySql;
使用命令編譯時:csc
/r:CoreLab.MySql.dll
test.cs
以下為訪問MYSQL資料庫實例
編譯指令:csc
/r:CoreLab.MySql.dll
/r:MySql.Data.dll
test.cs
using
System;
using
System.Net;
using
System.Text;
using
CoreLab.MySql;
using
System.Data.Odbc;
using
MySql.Data.MySqlClient;
class
ConnectMySql
{
public
void
Connect_CoreLab()
{
string
c;
MySqlConnection
mycn
=
new
MySqlConnection(constr);
mycn.Open();
MySqlCommand
mycm
=
new
MySqlCommand("select
*
from
shop",mycn);
MySqlDataReader
msdr
=
mycm.ExecuteReader();
while(msdr.Read())
{
if
(msdr.HasRows)
{
Console.WriteLine(msdr.GetString(0));
}
}
msdr.Close();
mycn.Close();
}
public
void
Connect_Odbc()
{
//string
MyC;
string
MyC
+
"SERVER=localhost;"
+
"DATABASE=test;"
+
"UID=root;"
+
"PASSWORD=qing;"
+
"OPTION=3";
OdbcConnection
MyConn
=
new
OdbcConnection(MyConString);
MyConn.Open();
OdbcCommand
mycm
=
new
OdbcCommand("select
*
from
hello",MyConn);
OdbcDataReader
msdr
=
mycm.ExecuteReader();
while(msdr.Read())
{
if
(msdr.HasRows)
{
Console.WriteLine(msdr.GetString(0));
}
}
msdr.Close();
MyConn.Close();
}
public
void
Connect_Net()
{
string
myC;
MySqlConnection
mycn
=
new
MySqlConnection(myConnectionString);
mycn.Open();
MySqlCommand
mycm
=
new
MySqlCommand("select
*
from
hello",mycn);
MySqlDataReader
msdr
=
mycm.ExecuteReader();
while(msdr.Read())
{
if
(msdr.HasRows)
{
Console.WriteLine(msdr.GetString(0));
}
}
msdr.Close();
mycn.Close();
}
public
static
void
Main()
{
ConnectMySql
ms
=
new
ConnectMySql();
ms.Connect_CoreLab();
ms.Connect_Odbc();
Connect_Net();
}
}
H. c#利用mysql connector net怎麼連接mysql資料庫
(1)首先需要下載C#訪問MySQL資料庫的ADO.NET驅動程序
mysql-connector-net-6.3.8.msi
(2)安裝mysql-connector-net
然後直接在Windows操作系統安裝 mysql-connector-net-6.3.8.msi
(3)封裝資料庫訪問組件DbConnectionMySQL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/// <summary>
/// MySQL資料庫
/// 版本 mysql-connector-net-6.3.8.msi
/// </summary>
[Serializable]
public class DbConnectionMySQL : DbConnectionWrapper
{
public DbConnectionMySQL(string pConnectionString)
: base(pConnectionString)
{
this.m_dbconn = new MySqlConnection(pConnectionString);
this.m_DbConnState = DbConnState.Free;
}
//--
public override DbDataAdapter GetDbDataAdapter()
{
return new MySqlDataAdapter();
}
public override DbDataAdapter GetDbDataAdapter(DbCommand dbCommand)
{
return new MySqlDataAdapter(dbCommand as MySqlCommand);
}
public override DbCommand GetDbCommand()
{
return new MySqlCommand();
}
public override DbConnection GetDbConnection()
{
return new MySqlConnection();
}
public override DbCommandBuilder GetDbCommandBuilder()
{
return new MySqlCommandBuilder();
}
public override DataProviderType GetCurrentDataProviderType()
{
return DataProviderType.Sql;
}
public override bool IsExistsTable(string TableName, string UserName)
{
#region information
bool rbc = false; //TABLES表中去查詢 table_name
string dSql = "select * from TABLES where table_name='" + TableName + "'";
DataSet ds = this.ExecuteDataSet(dSql);
if (ds != null)
{
if (ds.Tables[0].Rows.Count > 0)
{
rbc = true;
}
else
{
rbc = false;
}
}
else
{
rbc = false;
}
return rbc;
#endregion
}
public override bool IsExistsField(string FieldName, string TableName)
{
#region information
bool rbc = false;
string dSql = "";
dSql = "select * from " + TableName + " where 1<>1";
DataSet ds = this.ExecuteDataSet(dSql);
if (ds != null)
{
DataTable dt = ds.Tables[0];
for (int j = 0; j < dt.Columns.Count; j++)
{
if (dt.Columns[j].ColumnName.ToString().ToUpper() == FieldName.ToString().ToUpper())
{
rbc = true;
goto Return_End;
}
}
dt.Dispose();
dt = null;
}
ds.Dispose();
ds = null;
Return_End:
return rbc;
#endregion
}
public override char ParameterChar
{
get
{
return ':'; //SQLite的參數符號為:
}
}
public override DbParameter CreateParameter(string name, object value)
{
return new MySqlParameter(name, value);
}
public override DbParameter CreateParameter(string name)
{
DbParameter dbp = new MySqlParameter();
dbp.ParameterName = name;
return dbp;
}
public override DbParameter CreateParameter(string name, DbType dbtype, object value)
{
DbParameter dbp = new MySqlParameter();
dbp.ParameterName = name;
dbp.Value = value;
dbp.DbType = dbtype;
return dbp;
}
public override DbParameter CreateParameter(string name, DbType dbtype, int size, object value)
{
DbParameter dbp = new MySqlParameter();
dbp.ParameterName = name;
dbp.Value = value;
dbp.DbType = dbtype;
dbp.Size = size;
return dbp;
}
}
(4)客戶端開發實例
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
public void TestCShape_MySQL()
{
string constr = "server=localhost;User Id=root;password=root;Database=xp_users";
DbConnectionWrapper dbw = new DbConnectionMySQL(constr);
bool rbc=dbw.TestConnection();
this.Context.Response.Write(rbc);
string x = "";
//刪除語句
x = "delete from xp_users";
if (dbw.ExecuteQuery(x) > 0)
{
this.Context.Response.Write("刪除語句成功!下面是<a href="https://www..com/s?wd=SQL%E8%AF%AD%E5%8F%A5&tn=44039180_cpr&fenlei=-bIi4WUvYETgN-" target="_blank" class="-highlight">SQL語句</a>" + x);
}
//插入語句
x = "insert into xp_users(gid,uid,uname,sex,email,pwd) values('";
x += "1','hsg77','何XXX',1,'[email protected]','1')";
if (dbw.ExecuteQuery(x) > 0)
{
this.Context.Response.Write("插入語句成功!下面是<a href="https://www..com/s?wd=SQL%E8%AF%AD%E5%8F%A5&tn=44039180_cpr&fenlei=-bIi4WUvYETgN-" target="_blank" class="-highlight">SQL語句</a>"+x);
}
//查詢語句
DataTable dt = dbw.ExecuteDataTable("select * from xp_users");
if (dt != null && dt.Rows.Count > 0)
{
this.Context.Response.Write("用戶數:"+dt.Rows.Count);
}
if (dt != null)
{
dt.Dispose();
dt = null;
}
dbw.Dispose();
dbw = null;
}
I. C語言怎樣連接mysql資料庫
mysql是有c語言介面的,安裝相應庫後就可以鏈接了,一般連接mysql的函數是mysql_connect或者mysql_real_connect(大概就是這么拼的吧。。。)可以使用mysql_query執行sql語句
J. C#連接mysql資料庫,怎麼設置超時時間
MySQL查詢超時的設置方法
為了優化OceanBase的query timeout設置方式,特調研MySQL關於timeout的處理,記錄如下。
[plain]
mysql> show variables like '%time%';
+----------------------------+-------------------+
| Variable_name | Value |
+----------------------------+-------------------+
| connect_timeout | 10 |
| datetime_format | %Y-%m-%d %H:%i:%s |
| delayed_insert_timeout | 300 |
| flush_time | 1800 |
| innodb_lock_wait_timeout | 50 |
| innodb_old_blocks_time | 0 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| lc_time_names | en_US |
| lock_wait_timeout | 31536000 |
| long_query_time | 10.000000 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| slave_net_timeout | 3600 |
| slow_launch_time | 2 |
| system_time_zone | |
| time_format | %H:%i:%s |
| time_zone | SYSTEM |
| timed_mutexes | OFF |
| timestamp | 1366027807 |
| wait_timeout | 28800 |
+----------------------------+-------------------+
21 rows in set, 1 warning (0.00 sec)
重點解釋其中幾個參數:
connect_timeout:
The number of seconds that the mysqld server waits for a connect packet before respondingwith Bad handshake. The default value is 10 seconds as of MySQL 5.1.23 and 5 seconds before that. Increasing the connect_timeout value might help if clients frequently encounter errors of the form Lost connection to MySQL server at 『XXX』, system error: errno.
解釋:在獲取鏈接時,等待握手的超時時間,只在登錄時有效,登錄成功這個參數就不管事了。主要是為了防止網路不佳時應用重連導致連接數漲太快,一般默認即可。
interactive_timeout:
The number of seconds the server waits for activity on an interactive connection before closing it. An interactive client is defined as a client that uses the CLIENT_INTERACTIVE option to mysql_real_connect(). See alsowait_timeout.
解釋:一個持續SLEEP狀態的線程多久被關閉。線程每次被使用都會被喚醒為acrivity狀態,執行完Query後成為interactive狀態,重新開始計時。wait_timeout不同在於只作用於TCP/IP和Socket鏈接的線程,意義是一樣的。
MySQL可以配置連接的超時時間,這個時間如果做得太長,甚至到了10min,那麼很可能發生這種情況,3000個鏈接都被占滿而且sleep在哪,新鏈接進不來,導致無法正常服務。因此這個配置盡量配置一個符合邏輯的值,60s或者120s等等。
說人話:
命令行下面敲一個命令後,直至下一個命令到來之前的時間間隔為interactive_time,如果這個時間間隔超過了interactive_timeout,則連接會被自動斷開,下一個命令失敗。不過一般的mysql客戶端都有自動重連機制,下一個命令會在重連後執行。
[sql]
mysql> set interactive_timeout = 1;
Query OK, 0 rows affected (0.00 sec)
mysql> show session variables like '%timeout%';
+----------------------------+----------+
| Variable_name | Value |
+----------------------------+----------+
| connect_timeout | 10 |
| interactive_timeout | 1 |
| wait_timeout | 28800 |
+----------------------------+----------+
10 rows in set (0.00 sec)
=====
[sql]
mysql> set wait_timeout = 1;
Query OK, 0 rows affected (0.00 sec)
【去泡杯茶,等會兒】
mysql> show session variables like '%timeout%';
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 7
Current database: *** NONE ***
+----------------------------+----------+
| Variable_name | Value |
+----------------------------+----------+
| connect_timeout | 10 |
| interactive_timeout | 28800 |
| wait_timeout | 28800 |
+----------------------------+----------+
10 rows in set (0.01 sec)
wait_timeout:
The number of seconds the server waits for activity on a noninteractive connection (連接上沒有活動命令,可能是客戶端喝咖啡去了。)before closing it. Before MySQL 5.1.41, this timeout applies only to TCP/IP connections, not to connections made through Unix socket files, named pipes, or shared memory.
On thread startup, the session wait_timeout value is initialized from the global wait_timeout value or from the global interactive_timeout value, depending on the type of client
這里順帶解釋一下什麼是non-interactive connection
> Non-Interactive Commands
Just do a quick look up on a table without logging into the client, running the query then logging back out again.
You can instead just type one line using the ' -e ' flag.
[sql]
c:\mysql\bin\mysql -u admin -p myDatabase -e 'SELECT * FROM employee'
net_read_timeout / net_write_timeout
The number of seconds to wait for more data from a connection before aborting the read. Before MySQL 5.1.41, this timeout applies only to TCP/IP connections, not to connections made through Unix socket files, named pipes, or shared memory. When the server is reading from the client, net_read_timeout is the timeout value controlling when to abort. When the server is writing to the client, net_write_timeout is the timeout value controlling when to abort. See also slave_net_timeout.
On Linux, the NO_ALARM build flag affects timeout behavior as indicated in the description of the net_retry_count system variable.
解釋:這個參數只對TCP/IP鏈接有效,分別是資料庫等待接收客戶端發送網路包和發送網路包給客戶端的超時時間,這是在Activity狀態下的線程才有效的參數
JDBC setQueryTimeout函數:
為了避免查詢出現死循環,或時間過長等現象,而導致線程阻塞,在獲得Statement的實例後,stmt.setQueryTimeout(10); 避免因為查詢導致程序出現線程阻塞。
但昨天發現程序出現了,「ORA-01013: 用戶請求取消當前的操作」的異常。手工執行出錯SQL語句發現,這個語句耗時20多秒。因為setQueryTimeout(10),所以還沒有執行完查詢語句就拋出異常了。使用setQueryTimeout(10)時一定要把時間設置的長一些,如60秒以上。只要不導致線程長期阻塞,就可以。太短了容易拋出,「ORA-01013: 用戶請求取消當前的操作」的異常
JDBC實現setQueryTimeout的原理:
[java]
class IfxCancelQueryImpl extends TimerTask
implements IfmxCancelQuery
{
IfxStatement stmt;
Timer t = null;
public void startCancel(IfxStatement paramIfxStatement, int paramInt)
throws Exception
{
this.stmt = paramIfxStatement;
this.t = new Timer(true);
this.t.schele(this, paramInt * 1000);
}
public void run()
{
try
{
this.stmt.cancel();
this.t.cancel();
}
catch (SQLException localSQLException)
{
this.t.cancel();
throw new Error(localSQLException.getErrorCode() + ":" + localSQLException.getMessage());
}
}
}