Closed Thread
Results 1 to 9 of 9

Thread: Connecting to MySQL without DSN

  1. #1
    dirkfirst is offline Programming Expert
    Join Date
    May 2006
    Posts
    354
    Rep Power
    23

    Connecting to MySQL without DSN

    Is there a way to connect to MySQL without a DSN in the system?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    brackett is offline Programmer
    Join Date
    May 2006
    Posts
    192
    Rep Power
    22
    Depends on what provider your using. OleDb would be something like:
    Code:
    "Provider=MySQLProv;Data Source=mydb;User Id=UserName;Password=asdasd"
    Check ConnectionStrings.com for other variations.

  4. #3
    dirkfirst is offline Programming Expert
    Join Date
    May 2006
    Posts
    354
    Rep Power
    23
    I found a free library that allowed me to connect o mysql without DNS entries.

  5. #4
    Saint is offline Learning Programmer
    Join Date
    Aug 2006
    Posts
    63
    Rep Power
    0
    I found this which is in C# but you port it to managed C++


    You need to download and install this:
    http://dev.mysql.com/downloads/connector/net/1.0.html

    Code:
    			string MyConString = "SERVER=localhost;" +
    				"DATABASE=mydatabase;" +
    				"UID=testuser;" +
    				"PASSWORD=testpassword;";
    			MySqlConnection connection = new MySqlConnection(MyConString);
    			MySqlCommand command = connection.CreateCommand();
    			MySqlDataReader Reader;
    			command.CommandText = "select * from mycustomers";
    			connection.Open();
    			Reader = command.ExecuteReader();
    			while (Reader.Read())
    			{
    				string thisrow = "";
    				for (int i= 0;i<Reader.FieldCount;i++)
    						thisrow+=Reader.GetValue(i).ToString() + ",";
    				listBox1.Items.Add(thisrow);
    			}
    			connection.Close();
    Taken from http://bitdaddys.com/MySQL-ConnectorNet.html
    Hi >> Saint

  6. #5
    Void's Avatar
    Void is offline Programming Expert
    Join Date
    Jun 2006
    Posts
    410
    Rep Power
    23
    Saint said it. I've used that driver before and it preforms very well.
    Void

  7. #6
    Ronin is offline Programming Professional
    Join Date
    Apr 2006
    Posts
    309
    Rep Power
    24
    Is this a secure way to connect though? I mean, can't anyone that uses your client to connect be able to retrieve your username and password? You had better think on that before releasing this software to the public. You may end up with an empty DB.

  8. #7
    dirkfirst is offline Programming Expert
    Join Date
    May 2006
    Posts
    354
    Rep Power
    23
    I'm not sure if it is very secure or not. It doesn't seem very secure.....

  9. #8
    brackett is offline Programmer
    Join Date
    May 2006
    Posts
    192
    Rep Power
    22
    It's as secure as the client. In other words, if you've set up DB access correctly so that the login provided only has permissions to do certain things - then anyone with that login only has permissions to do the same things your app does.

    In other words - no it's not secure. But it's not really supposed to be either. Security is enforced at the database in this situation.

  10. #9
    Jordan Guest
    In other words dirkfirst, you should set grant permissions very limiting from the app connecting to your DB.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Beginner Connecting to MYSQL Database!
    By Epatron in forum PHP Tutorials
    Replies: 7
    Last Post: 08-16-2011, 11:14 AM
  2. MySQL connecting to Sequel Pro
    By haraldur in forum Database & Database Programming
    Replies: 3
    Last Post: 11-27-2009, 06:50 AM
  3. Connecting to MySQL database
    By Vswe in forum Database & Database Programming
    Replies: 4
    Last Post: 08-25-2009, 02:34 PM
  4. Connecting to MySQL with Java
    By Coldhearth in forum Java Help
    Replies: 4
    Last Post: 12-24-2008, 08:16 AM

Tags for this Thread

Bookmarks

Posting Permissions

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