Go Back   NexusDB Newsgroups > Support Newsgroups > nexusdb.public.support.adoprovider
Log in
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Thread Tools Display Modes
  #1  
Old 20th April 2018, 07:50 AM
philiplin1208 philiplin1208 is offline
Junior Member
 
Join Date: Mar 2018
Posts: 3
Default Couldn't (re)connect to the server: Only one usage of each socket address permitted

Hi there,

I am using Ado.Net provider to insert 10000 records into a table. However, I always get this error:

Couldn't (re)connect to the server: Only one usage of each socket address (protocol/network address/port)permitted 127.0.0.1:16080

I am using the NexusDB ADO Provider Demo to perform the above mentioned action. (only added a for loop to run 10000 times)

Here is the code:

private DbConnection OpenConnection()
{
DbConnection conn = null;
string connstring = "";

if (rbNative.Checked)
connstring = String.Format("server={0};database={1};port={2};Na tive=true", edNativeServer.Text, edNativeDatabase.Text, edNativePort.Text);
if (rbManaged.Checked)
connstring = String.Format("server={0};database={1};port={2}", edManagedServer.Text, edManagedDatabase.Text, edManagedPort.Text);
if (rbEmbedded.Checked)
connstring = String.Format("server={0};database={1};port={2};Em bedded=true", "Embedded", edDBFolder.Text, "16080");

string provider = "NexusDB.ADOProvider";
DbProviderFactory factory = DbProviderFactories.GetFactory(provider);
conn = factory.CreateConnection();

conn.ConnectionString = connstring;

edConnectionString.Text = connstring;

try
{
conn.Open();
}
catch (Exception ex)
{
if (ex.Message.Contains("0x8007007E"))
MessageBox.Show(String.Format("Error: {0}\n\nPlease make sure the ADOConnectorV3.dll is in the application folder or accessible from the system path.", ex.Message));
else
MessageBox.Show(String.Format("Error: {0}", ex.Message));
conn = null;
}
return conn;
}

private void button2_Click(object sender, EventArgs e)
{
if (listBox1.FindString("NexusDB Data Provider") < 0)
{
MessageBox.Show("NexusDB Provider not installed into environment. Please run the RuntimeInstaller and try again");
return;
}
try
{
for (int i = 0; i <= 10000; i++)
{
DbConnection conn = OpenConnection();
if (conn != null)
{
try
{
DbCommand comm = conn.CreateCommand();
comm.CommandText = edQuery.Text;
comm.ExecuteNonQuery();
}
catch
{

throw;
}
finally
{
conn.Close();
}
}
}
}
catch (Exception ex)
{

}
}

I can do a read query 10000 times without a problem, but with insert, after certain times, it always gives me the above mentioned error. Please help...
  #2  
Old 20th April 2018, 11:23 PM
Eivind Eivind is offline
Administrator
 
Join Date: Mar 2008
Posts: 144
Default

Quote:
Originally Posted by philiplin1208 View Post
Hi there,

I am using Ado.Net provider to insert 10000 records into a table. However, I always get this error:

Couldn't (re)connect to the server: Only one usage of each socket address (protocol/network address/port)permitted 127.0.0.1:16080

I am using the NexusDB ADO Provider Demo to perform the above mentioned action. (only added a for loop to run 10000 times)

Here is the code:

private DbConnection OpenConnection()
{
DbConnection conn = null;
string connstring = "";

if (rbNative.Checked)
connstring = String.Format("server={0};database={1};port={2};Na tive=true", edNativeServer.Text, edNativeDatabase.Text, edNativePort.Text);
if (rbManaged.Checked)
connstring = String.Format("server={0};database={1};port={2}", edManagedServer.Text, edManagedDatabase.Text, edManagedPort.Text);
if (rbEmbedded.Checked)
connstring = String.Format("server={0};database={1};port={2};Em bedded=true", "Embedded", edDBFolder.Text, "16080");

string provider = "NexusDB.ADOProvider";
DbProviderFactory factory = DbProviderFactories.GetFactory(provider);
conn = factory.CreateConnection();

conn.ConnectionString = connstring;

edConnectionString.Text = connstring;

try
{
conn.Open();
}
catch (Exception ex)
{
if (ex.Message.Contains("0x8007007E"))
MessageBox.Show(String.Format("Error: {0}\n\nPlease make sure the ADOConnectorV3.dll is in the application folder or accessible from the system path.", ex.Message));
else
MessageBox.Show(String.Format("Error: {0}", ex.Message));
conn = null;
}
return conn;
}

private void button2_Click(object sender, EventArgs e)
{
if (listBox1.FindString("NexusDB Data Provider") < 0)
{
MessageBox.Show("NexusDB Provider not installed into environment. Please run the RuntimeInstaller and try again");
return;
}
try
{
for (int i = 0; i <= 10000; i++)
{
DbConnection conn = OpenConnection();
if (conn != null)
{
try
{
DbCommand comm = conn.CreateCommand();
comm.CommandText = edQuery.Text;
comm.ExecuteNonQuery();
}
catch
{

throw;
}
finally
{
conn.Close();
}
}
}
}
catch (Exception ex)
{

}
}

I can do a read query 10000 times without a problem, but with insert, after certain times, it always gives me the above mentioned error. Please help...
Exactly what version of the provider are you using?

Eivind
  #3  
Old 21st April 2018, 12:47 AM
philiplin1208 philiplin1208 is offline
Junior Member
 
Join Date: Mar 2018
Posts: 3
Default

Hi Eivind,

The file version of NexusDB.ADOProvider.dll is 2.0.7.124

Thanks,

Philip Lin
  #4  
Old 21st April 2018, 02:15 AM
philiplin1208 philiplin1208 is offline
Junior Member
 
Join Date: Mar 2018
Posts: 3
Default

Hi Eivind,

I am using the file version of 2.0.7.124

Thanks,

Philip Lin


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Error: Couldn't (re)connect to the server:" in Managed Mode John Myren nexusdb.public.support.adoprovider 4 22nd February 2015 12:01 PM
Zero DateTime no longer permitted David Rose nexusdb.public.support 6 11th January 2012 10:18 PM
Error msg "...Only one usage of each socket address...is normallypermitted" Edward nexusdb.public.support 17 22nd November 2007 12:11 PM
Assigning an IP address to a server John Turner nexusdb.public.support 3 8th July 2006 08:12 AM
Getting the Server Address David Guest nexusdb.public.discussions 3 30th November 2003 10:25 PM


All times are GMT +11. The time now is 01:13 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.