This topic is locked

Connecting local computer for database while application is on Web

7/14/2010 9:04:35 AM
ASPRunnerPro General questions
A
admin author

Hi Guys,
I am lost as some guys say it is possible while other say not possible. I am trying to develop following scenerio, I will highly appreciate if anybody can help me.
1). I have ASP runner pro application loaded on the Web Server with MS Sql server database. which is running fine.
2). I want to develop kind of thing that when I access that applicatin from any web clinet then it should connect the web client (local computer where web page is being access) database.

to implement the above I am assuming following as a prerequisite on web client.

  • Same name ODBC (as on the web server to connect the application) will be present on web client connecting the database.
  • The database on the web client will be exactly (bit to bit) same as on the web server.
    Please let me know whether it is possible of not and how.
    Sami

Sergey Kornilov admin 7/15/2010

This is quite possible.
Here is the sample connection string that uses SQL Server IP address to connect:

Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;


Replace IP address with IP address of your local machine and make sure SQL Server accepts outside connections (port 1433 must be open in your firewall).

A
admin author 7/18/2010



This is quite possible.
Here is the sample connection string that uses SQL Server IP address to connect:

Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;


Replace IP address with IP address of your local machine and make sure SQL Server accepts outside connections (port 1433 must be open in your firewall).


Thanks Sergy
But local computer will be changing everytime as it's not limitted to certain user and the idea is any web user can use with certain prerequisite, so if we fix some IP then it will be restricted to that only.
For me i am assuming that there should be a dynamic way to maintain the connection string as it can not be fixed with on local client.
(For me it looks like that connection string should be made dynamically for each session for each user, I know this looks like very difficult but i think no harm to discuss or then I should consider it that it is impossible)
need expert's comments on this, Hope I am able to expalin properly.
Thanks & Regards

Sami

Sergey Kornilov admin 7/18/2010

It's possible to implement dynamic connection string. You can try to use AfterAppInitialized event and the following code:

strConnection = "Data Source=" & Request.ServerVariables("REMOTE_ADDR") & ",1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;"