dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 15

Thread: Connect vb6 to a database uploaded on a website ??

  1. #1
    Join Date
    May 2011
    Posts
    6

    Connect vb6 to a database uploaded on a website ??

    Hi, i surfed a lot of sites and couldnt find an exact answer to my query.

    I need to develop a Desktop application (.exe) file for a small company. The company that i am developing the software for needs to have database wherein they can store their products information. The problem is, the company has its warehouse in a different city and they want to be able to add/update stocks from that city and the new stock and products should show up in the application which is in main branch.

    The only solution i can think of for this problem is have a database uploaded on a website and use the front end .exe to connect to the database and read/write/update information to the database from the application itself.

    I have never developed such an app before. I have developed various apps in vb6 using access as the database but that was intended only to run on a single pc with no sorts of internet involved.

    Now i would like to know is it possible to have a database (ms access or any other for that matter) uploaded onto a website like www.xyz.com and then have a vb6 app coded with the connections made to the website and withing the vb6 app have the capability to add/update/delete records in the table of the database.

    Important Points

    1. I have no security concerns/issues.

    2. The database needs to have only 1 Table and a few fields, so it isnt going to be a very big file.

    3. The amount of users accessing the database will be a maximum of 2 at a time. Not more than that. More often than not it will only be 1 user, but there might be an instance when the main branch and the warehouse are using the software together.

    4. I m open to learn a new database like mysql or sqlserver if that is more appropriate to use. I am not looking at guide, but i would want instructions on how to start and what are the things i should be knowing.

    5. I havent started coding the app yet, so i can code it using a different environment or using .net if thats more appropriote

    Info about the website.

    1.The website is a registered domain www.xyz.com and the company will provide me Cpanel to the website. We can also register a completely new domain if thats required.

    2. The app strictly needs to be a desktop based .exe file and not anything related to the web.

    I have never developed an app which communicates through the internet, so i would appreciate if you guys can provide info keeping my knowledge level in mind. I have succesfully developed various apps using ADO recordsets though.!

    I look forward to your help. All replies will be appreciated. Thanks !

    if there are any more details about the internet/server that i need to know, please let me know and i will ask them and post it here.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Connect vb6 to a database uploaded on a website ??

    I would forget about VB6 altogether. It's lived for 20 years, and shouldn't be used for new projects.

    Not having security concerns is the BIGGEST problem you have now. Security needs to be designed INTO the system, rather than added in at the last minute.

    You can write a program in VB.Net, that hooks into any db. When you want to change the DB, the only change you make is to the SQL Connection string.

    You can get VS2010 Express for FREE, as well as SQL Express. That's all you need to get started (and probably good for the app).

    If you get a cPanel account at GoDaddy, for instance, they'll give you a SQL 2005 server with your site. Change the connection string to the theirs, and connect.

    Most programs have one password to get in, but create USERS and ADMINS that are allowed to modify things.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    May 2011
    Posts
    6

    Re: Connect vb6 to a database uploaded on a website ??

    Hi, Firstly, my sincere apologies for the delay in response.

    Secondly, Thank you for a very detailed response.

    I was discussing this with my client and we have decided to do it the mysql way. They have provided me the Cpanel rights to their website and i have successfully created the database and table along with the fields. It was pretty easy when i got the exact instructions frm a friend. I have created a strong password, so i guess that will take care of the security needs for the database.

    I already have both sql server and visual studio but i m more comfortable with vb and i still have to learn alot in VS and SQl.

    So i have decided to stick to vb6 and have the database on d website in mysql and use the front end to modify/make changes.

    The problem now is i cannot get the connection right. I have the correct versions of odbc drivers which is 3.51 and i have the correct connection string from www.connectionstrings.com but till now no luck. I get the error, ['Access denied for the user 'username'@ 'my ip'' ]. I tried using the odbc connection wizard under control pannel and still no luck. I know that the password, username and the server name are all correct. I also tried putting the cpanel password yet no luck.

    I m not sure why this is happening. I disabled the firewall, turned uac off still no luck. Is it that the server is blocking my ip ?? Is there some coding i m missing or something that i m doing wrong. Google search shows up numerous posts, but none of them helped so far.

    If the server is blocking, how can i be sure that its the server fault ? Are there any websites wherein i can just create a test mysql database and use it for trial purpose. If i can do this then it will be a matter of mins to conclude whether its the server or my pc which is at fault.

    I look forward to your answers on my queries.

    I apologize for the delay in response and i m thankful for your help and efforts to reply to the thread. God bless.

    Just for info : When i go to the phpmyadmin i get the following details.

    Server: Localhost via UNIX socket

    User : ****@localhost

    This is the first time i m building a client/server app, so i have really no clue what is it that i m doing wrong. I will appreciate all your help. Thanks again !

  4. #4
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Connect vb6 to a database uploaded on a website ??

    That's your server, not the ISP via CPANEL. You have to change the connection string, and then COMPILE AGAIN for the WEB.

    VS2010 allows 1 button PUBLISH, which lets you update the app when there are new versions. It can check each time the program runs, or once a week.

    VB6 can't do that!
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  5. #5
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,319

    Re: Connect vb6 to a database uploaded on a website ??

    So are you trying to write an application that runs locally but connects to a database that is located outside your network on the internet? If so I am not sure how that would work out. If you manage to get it to work post your solution.
    Always use [code][/code] tags when posting code.

  6. #6
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: Connect vb6 to a database uploaded on a website ??

    Quote Originally Posted by techspark View Post
    The problem now is i cannot get the connection right. I have the correct versions of odbc drivers which is 3.51 and i have the correct connection string from www.connectionstrings.com but till now no luck. I get the error, ['Access denied for the user 'username'@ 'my ip'' ].
    The Access denied, is an error supplied from the MySQL database. Basically, it is telling you that your "username" is not allowed to access the database from the IP address you are coming from. You will need to issue the following queries on your MySQL database.

    CREATE USER 'username'@'%' IDENTIFIED BY 'mypassword';
    GRANT ALL ON *.* TO 'username'@'%';
    FLUSH PRIVILEGES;

    The '%' part allows this user to connect from anywhere.

    See the following link for more information.
    http://dev.mysql.com/doc/refman/5.0/en/grant.html

  7. #7
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: Connect vb6 to a database uploaded on a website ??

    Quote Originally Posted by DataMiser View Post
    So are you trying to write an application that runs locally but connects to a database that is located outside your network on the internet? If so I am not sure how that would work out. If you manage to get it to work post your solution.
    For his particular application (1 table and a few fields), it will work fine. If you have a more involved application, you can get it to work acceptably, but you have to pay particular attention to design/data access and the amount of information pushed over the wire. For Example, you do not want to give a datagrid control access to a whole table. You really have to issue very specific SELECT statements in order to limit the amount of data. I have done this several time and with a few exceptions (screens that need a lot of data), it works fine.


    However, now I would use something like silverlight (cool controls) and .net running on a web site instead of vb.

  8. #8
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,319

    Re: Connect vb6 to a database uploaded on a website ??

    Thanks for the info, I figured there must be a way to connect remotely but had never looked into it. Most of the apps I have written that need to work remotely are mobile based and have to work in disconnected mode so I use a client server with a store and forward routine that I designed.

    The ones I have written which need to have access to a database on the internet have all been done as web sites. In both cases I try and send as little data across the wire as possible to get the job done.
    Always use [code][/code] tags when posting code.

  9. #9
    Join Date
    May 2011
    Posts
    6

    Re: Connect vb6 to a database uploaded on a website ??

    Quote Originally Posted by sotoasty View Post
    The Access denied, is an error supplied from the MySQL database. Basically, it is telling you that your "username" is not allowed to access the database from the IP address you are coming from. You will need to issue the following queries on your MySQL database.

    CREATE USER 'username'@'%' IDENTIFIED BY 'mypassword';
    GRANT ALL ON *.* TO 'username'@'%';
    FLUSH PRIVILEGES;

    The '%' part allows this user to connect from anywhere.

    See the following link for more information.
    http://dev.mysql.com/doc/refman/5.0/en/grant.html
    Thanks, this is what i was looking at. Can you provide more details on how i can do this. I tried going to the query section of mysql database but i end up getting this error "#1045 - Access denied for user 'xx'@'localhost' (using password: YES) "
    I have never used mysql before, so all of this is very new to me. Am i doing it right, where should i be entering the query ?
    Also, there is an option of remote mysql on the cpanel page, can i add my ip there and will it then allow the connections from the vb6 app ??

    Btw, i m using freemysql.net and everything works perfect. The database gets connected fine, datagrid shows all the updates and save/search works fine. The only problem is, its a free website and if incase it goes down or stops providing access in d future, we will be in big trouble. One more prob with it is that that the connection timesout every 10secs, i.e if my vb6 app is idle for 10 secs, i get an error saying the mysql server has gone away. After a little bit of searching on d forums, the issue is because the wait_timeout variable is set to 10. Is there a way i can change this ?? I tried hard but no luck.

    Looking forward to your response. Thanks!

  10. #10
    Join Date
    Sep 2000
    Location
    FL
    Posts
    1,452

    Re: Connect vb6 to a database uploaded on a website ??

    This part...

    Access denied for user 'xx'@'localhost' (using password: YES)

    Means that the user you are attempting to use does not have the correct privileges on the MySQL database for what you are trying to do. I would think, there might be some option in cPanel to add a mysql user and give that user access. I have only used cPanel once and that was years ago. Once you do get a user access, then you can use the Query section.

  11. #11
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Connect vb6 to a database uploaded on a website ??

    You are supposed to supply the ADMINISTRATOR credentials. They had to have you set it up the first time. Once for each DB.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  12. #12
    Join Date
    May 2011
    Posts
    6

    Re: Connect vb6 to a database uploaded on a website ??

    Hi, i had to enter my ip address in the remote mysql under cpanel and that fixed the error. I can now connect to the database from my pc. Thanks for all the help.

    Hi, can you also guide on what is the best way of having email capabilities within the application. A good beginner tutorial will be much appreciated.
    Last edited by techspark; June 20th, 2011 at 02:03 PM.

  13. #13
    Join Date
    Nov 2009
    Posts
    1

    Re: Connect vb6 to a database uploaded on a website ??

    Quote Originally Posted by sotoasty View Post
    For his particular application (1 table and a few fields), it will work fine. If you have a more involved application, you can get it to work acceptably, but you have to pay particular attention to design/data access and the amount of information pushed over the wire. For Example, you do not want to give a datagrid control access to a whole table. You really have to issue very specific SELECT statements in order to limit the amount of data. I have done this several time and with a few exceptions (screens that need a lot of data), it works fine.


    However, now I would use something like silverlight (cool controls) and .net running on a web site instead of vb.
    I have a VB6 program that creates an array with between 3 and 4 million lines. The user can save the data to multiple CSV files of I million lines max (so Excel can load them). I'd like to upload the entire array to an online Azure database. I was wondering how you would approach this task. Any advice would be appreciated.

  14. #14
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    12,986

    Re: Connect vb6 to a database uploaded on a website ??

    Quote Originally Posted by mscir View Post
    I have a VB6 program that creates an array with between 3 and 4 million lines. The user can save the data to multiple CSV files of I million lines max (so Excel can load them). I'd like to upload the entire array to an online Azure database. I was wondering how you would approach this task. Any advice would be appreciated.
    Why not start a new post? This 7 year old post has nothing to do with uploading csv files into Azure.

  15. #15
    Join Date
    Nov 2018
    Posts
    1

    Re: Connect vb6 to a database uploaded on a website ??

    Quote Originally Posted by sotoasty View Post
    The Access denied, is an error supplied from the MySQL database. Basically, it is telling you that your "username" is not allowed to access the database from the IP address you are coming from. You will need to issue the following queries on your MySQL database.

    CREATE USER 'username'@'%' IDENTIFIED BY 'mypassword';
    GRANT ALL ON *.* TO 'username'@'%';
    FLUSH PRIVILEGES;

    The '%' part allows this user to connect from anywhere.

    See the following link for more information.
    http://dev.mysql.com/doc/refman/5.0/en/grant/buyessay
    Thank you for providing right SQL query, hope I won't have any problems now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)