黑马程序员技术交流社区
标题:
测试Oracle数据库最大的连接数
[打印本页]
作者:
aisini
时间:
2014-7-30 11:43
标题:
测试Oracle数据库最大的连接数
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OracleClient;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
button1.Enabled = false;
int abc = 0;
try
{
for (int i = 0; i < 1000; i++)
{
abc = i;
OracleConnection connection = new OracleConnection("Data Source=ORCL;Persist Security Info=True;User ID=ZMZXSYS;Password=admin;Unicode=True");
connection.Open();
}
MessageBox.Show("数据库连接数大于:" + abc.ToString());
}
catch (Exception err)
{
this.Text = abc.ToString();
MessageBox.Show("数据库连接最大数为:"+ abc.ToString());
//throw (err);
}
button1.Enabled = true;
}
}
}
复制代码
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2