Can connect to database on Net? I need help.

damxuanthai

Well-known member
Joined
Mar 1, 2007
Messages
48
Location
Việt Nam.
Programming Experience
Beginner
Hi all Profs.

I have a question.

I have got a website, and store a access database in hosting. (example: www.damxuanthai.edu.vn/data/UserData.mdb).

Now I make a appication (Window form), and I wish it could read and write data to the database above.

I have known that, it can use Oledb to connect to mdb database in local machine. But If Oledb still useful to connect to mdb database on Hosting server?. And if Yes, How can I make a connection String.

Plz help me. How can I do?

Thank you for reading and hope on your feedback.

Thai, Dam Xuan
 
Hi Xuan,

support for remote access with regards to CSDL Access is very limited especially if it's not on a local network. If it is hosted in an ISP environment, you will not be able to take advantage of it from distributed applications.

You might look into the possibility of mySql as almost all ISP support it for free.

with regards to connection string info, you can find it here: http://www.connectionstrings.com


Here are some additional links you might be interested in:

http://www.cuasotinhoc.com
http://www.ddth.com
http://www.diendantinhoc.com
 
Thank to giadich.

You mean there is no way to access mdb file located in hosting server. :confused:

Someone have another answer ?

(I need my application can check user name and password in mdb hosted file and let user login. It the same way 'Yahoo messenger chat' program do, we must loggin to chat, I am sure it must access to one hosting database. So How can Yahoo do?)

Are there any solution?

Thank you for reading, and waiting your feedback.

Thai, Dam Xuan
 
Last edited by a moderator:
No, it's not entirely impossible to access remote mdb file. But given the circumstances, especially hosted ISP environment, it is not feasible to do what you normally can in a local LAN environment.

But that doesn't mean you are completely locked out of your mdb file. you can still create web services that access mdb and provide the functionality needed to perform authentication for your user to login.

windows service can also do the job if you can have control over the server to install the service.

there's another thing which might be of interest to you and it's rather new is WCF. I haven't actually use this, but have seen a couple of demonstration and it's very good.
 
Thank giadich very much.

Its True that it is not easy to access to remote access database.

So if I use mssql (mdf) instead, it can be possible and easier (my hosting accepts sqlserver2005). Can I use SQLconnection and how to make connection string? (I have never make any web service, coz I am a beginer...)

Thank you for reading, and waiting your feedback.

Thai, Dam Xuan

'To JohnH: I have some vietnammese words in previous post. It is only the "Say hello to giadich" in Vietnamese, it did not contain any bad infomation :D. plz dont mind about it. And Could I have your help in this entry (access to remote database mdb, mdf file)?
 
'To JohnH: I have some vietnammese words in previous post. It is only the "Say hello to giadich" in Vietnamese, it did not contain any bad infomation :D. plz dont mind about it. And Could I have your help in this entry (access to remote database mdb, mdf file)?
That is comforting to hear, while it can't be verified ;) Don't do that again, this is English-only speaking forum.

Access isn't a Database service and isn't meant for such operation, while people try: Why can't I access a database or text file on another server?
 
if your hosting company is supporting mssql then you should go ahead and take advantage of it.

just one thing though, you'll need to make sure that on the client side, port 1433 (default sql port) must be opened.

PS. If you wish to send some non-english message, you could use private message by clicking on the name then choose Send a Private Message.
 
giadich: Thank you very much

follow to your advice, I have made a winform and try to connect to SQLserver.
I have already a database name: DbName in my web hosting server.
User is user, pw is password.
I try to connect by this code below
But Error (see more Attached img), I think I must declare more clearly the address of the server Where DBname located, and I have not enough experiences to know How to fix, edit the code.
Some one can help me plz.
Thank you very much



VB.NET:
Imports System.Data.SqlClient

PublicClass Form1

Private gsCon AsString = "Data Source=localhost;Connection Timeout=15;Packet Size=0000;Integrated Security=no;User ID=user;Password=password;Encrypt=no;Initial Catalog= DBName"

PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim strSQL AsString = "SELECT * FROM Users"

Dim strError AsString = ""

Dim myCon As New SqlConnection(gsCon)

Try

myCon.Open()

Dim myCom As New SqlCommand(strSQL, myCon)

myCom.ExecuteNonQuery()

Catch ex As Exception

strError = ex.Message

Finally

myCon.Close()

myCon.Dispose()

End Try

MsgBox(strError)

End Sub

End Class
 

Attachments

  • Error.jpg
    Error.jpg
    21.2 KB · Views: 35
Hi,

Just a sharing and I might be wrong. I had this error before when I use the SQL Server Express version.

The error pop-up probably the SQL server 2005 you use haven't configure to allow the remote connection.

The configuration can be done by:
1) Go to the surface area configuration for services and connections, set the Remote Connections to allow the Local and remote connections.
2) In the SQL Server Configuration Manager, under the SQL Server 2005 Network Configuration section->Protocols for SQLExpress, select the protocol you want to use, and enable it. Remember to configure it's IP or port so that it is in syn with your application.
 
"Data Source=localhost;Connection Timeout=15;Packet Size=0000;Integrated..."

you can't run the winform and set the datasource to "localhost" then run it on your machine.

you need to make sure that the database is accessible from your machine and set the datasource to point to the ip address that your hosting company provided.
 
giadich: Thank you very much.
I have change the connectionString to:
VB.NET:
Private gsCon AsString = "Data Source=210.245.87.113 ;Connection Timeout=15;Packet Size=0000;Integrated Security=no;User ID=user;Password=password;Encrypt=no;Initial Catalog= DBName"
I have got 210.245.87.113 from my hoster. It is mysite IP (shared IP)
But the result still Error? I dont know Why?
Thank you for your fedbacks and hope get more.
 
Hi,

Just a sharing and I might be wrong. I had this error before when I use the SQL Server Express version.

The error pop-up probably the SQL server 2005 you use haven't configure to allow the remote connection.

The configuration can be done by:
1) Go to the surface area configuration for services and connections, set the Remote Connections to allow the Local and remote connections.
2) In the SQL Server Configuration Manager, under the SQL Server 2005 Network Configuration section->Protocols for SQLExpress, select the protocol you want to use, and enable it. Remember to configure it's IP or port so that it is in syn with your application.

Thank you very much.

All your advices I understand is: I must go to my host company, and ask them to make some configurations. is It right? Can I make it remote?
My hoster provide the Plesk 8.3 to control my hosting myself. Can I solve this problem by using it (I have not use it since I hosting)?

Dam Xuan Thai
 
Back
Top