Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsVB SyntaxEnterprise DevelopmentDatabase AccessControlsCOMWin APICrystal ReportDeploymentGeneralGeneral 2
Related Topics
VB.NET / ASP.NETMS SQL ServerMS AccessOther Database ProductsMore Topics ...

VB Forum / General / July 2008



Tip: Looking for answers? Try searching our database.

MySQL Database Connection

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
duke - 31 Jul 2008 03:55 GMT
I have installed MySQL Server 5.1 on my machine.
I need to write a VB App that will allow me to connect to a database
that is on my machine (localhost) "D:\MySQL Datafies\data\ibdata1"

I have been wrestling with various connect statements I found on
connectionstrings.com specifically this one:

Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=myDataBase;
User=myUsername;Password=myPassword;Option=3;

I believe my problem is the way I am entering "Database=myDataBase;"
but just have no success.
I am prepared to give up my first born to the person who gives me the
proper connection string.

TIA
Jason Keats - 31 Jul 2008 07:38 GMT
|I have installed MySQL Server 5.1 on my machine.
| I need to write a VB App that will allow me to connect to a database
[quoted text clipped - 12 lines]
|
| TIA

Try http://www.carlprothman.net/Default.aspx?tabid=81 for connection
strings.

http://www.carlprothman.net/Default.aspx?tabid=90#ODBCDriverForMySQL matches
what you're doing.

I don't think I'd be using localhost.
Paul Clement - 31 Jul 2008 13:09 GMT
¤ I have installed MySQL Server 5.1 on my machine.
¤ I need to write a VB App that will allow me to connect to a database
¤ that is on my machine (localhost) "D:\MySQL Datafies\data\ibdata1"
¤
¤ I have been wrestling with various connect statements I found on
¤ connectionstrings.com specifically this one:
¤
¤ Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=myDataBase;
¤ User=myUsername;Password=myPassword;Option=3;
¤
¤ I believe my problem is the way I am entering "Database=myDataBase;"
¤ but just have no success.
¤ I am prepared to give up my first born to the person who gives me the
¤ proper connection string.

You may want to post the error you are receiving and a snippet of your code.

Paul
~~~~
Microsoft MVP (Visual Basic)
duke - 31 Jul 2008 15:24 GMT
On Jul 31, 6:09 am, Paul Clement
<UseAdddressAtEndofMess...@swspectrum.com> wrote:

> You may want to post the error you are receiving and a snippet of your code.
>
> Paul
> ~~~~
> Microsoft MVP (Visual Basic)

Here are the various things I tried: ( Note: Bad attempts Commented
out )

Please remember for those who are not familar with MySQL Connector,
it  brings up an input form with the parameters preloaded and a
connect button available.

Private Sub cmdConnectMySQL_Click()
 Dim cnMySql As New rdoConnection
 Dim rdoQry As New rdoQuery
 Dim rdoRS As rdoResultset

 ' set up remote data connection using the
 ' MySQL ODBC driver

 cnMySql.CursorDriver = rdUseOdbc

 'cnMySql.Connect = "uid=;pwd=;server=;" & "driver={MySQL ODBC 3.51
Driver};database=;dsn='';"

 'cnMySql.Connect = "uid=sysadmin;pwd=mypassword;server=localhost;" &
"driver={MySQL ODBC 3.51 Driver};database=simply;"

 'cnMySql.Connect = "Driver={MySQL ODBC 3.51
Driver};Server=localhost;Database=d:\mysql datafiles\data\ibdata1;
User=sysadmin;Password=sysadmin;Option=3;"

 cnMySql.Connect = "DRIVER={MySQL ODBC 3.51 Driver};" & _
                  "Server=localhost;" & _
                  "Port=3306;" & _
                  "Option=16384;" & _
                  "Stmt=;" & _
                  "Database=d:\mysql datafiles\data\ibdata1;" & _
                  "Uid=sysadmin;" & _
                  "Pwd=myPassword;"

 cnMySql.EstablishConnection

 cnMySql.Close

End Sub

Error Message form EstablishConnection:

Run-time error: 40002
S1000: [MySql][OBDC 3.51 Driver] Access denied for user
'sysadmin@localhost' (Using Password=Yes)

Unless you have the connector installed, you won't be able to
duplicate the problem.

Duke
Paul Clement - 31 Jul 2008 18:27 GMT
¤ Here are the various things I tried: ( Note: Bad attempts Commented
¤ out )
¤
¤ Please remember for those who are not familar with MySQL Connector,
¤ it  brings up an input form with the parameters preloaded and a
¤ connect button available.
¤
¤ Private Sub cmdConnectMySQL_Click()
¤   Dim cnMySql As New rdoConnection
¤   Dim rdoQry As New rdoQuery
¤   Dim rdoRS As rdoResultset
¤
¤   ' set up remote data connection using the
¤   ' MySQL ODBC driver
¤
¤   cnMySql.CursorDriver = rdUseOdbc
¤
¤   'cnMySql.Connect = "uid=;pwd=;server=;" & "driver={MySQL ODBC 3.51
¤ Driver};database=;dsn='';"
¤
¤   'cnMySql.Connect = "uid=sysadmin;pwd=mypassword;server=localhost;" &
¤ "driver={MySQL ODBC 3.51 Driver};database=simply;"
¤
¤   'cnMySql.Connect = "Driver={MySQL ODBC 3.51
¤ Driver};Server=localhost;Database=d:\mysql datafiles\data\ibdata1;
¤ User=sysadmin;Password=sysadmin;Option=3;"
¤
¤   cnMySql.Connect = "DRIVER={MySQL ODBC 3.51 Driver};" & _
¤                    "Server=localhost;" & _
¤                    "Port=3306;" & _
¤                    "Option=16384;" & _
¤                    "Stmt=;" & _
¤                    "Database=d:\mysql datafiles\data\ibdata1;" & _
¤                    "Uid=sysadmin;" & _
¤                    "Pwd=myPassword;"
¤
¤   cnMySql.EstablishConnection
¤
¤   cnMySql.Close
¤
¤ End Sub
¤
¤
¤ Error Message form EstablishConnection:
¤
¤ Run-time error: 40002
¤ S1000: [MySql][OBDC 3.51 Driver] Access denied for user
¤ 'sysadmin@localhost' (Using Password=Yes)
¤
¤
¤ Unless you have the connector installed, you won't be able to
¤ duplicate the problem.

You might want to take a look at the following thread:

http://forums.mysql.com/read.php?37,2688,2688#msg-2688

Paul
~~~~
Microsoft MVP (Visual Basic)
Henning - 31 Jul 2008 20:31 GMT
On Jul 31, 6:09 am, Paul Clement
<UseAdddressAtEndofMess...@swspectrum.com> wrote:

> You may want to post the error you are receiving and a snippet of your
> code.
>
> Paul
> ~~~~
> Microsoft MVP (Visual Basic)

Here are the various things I tried: ( Note: Bad attempts Commented
out )

Please remember for those who are not familar with MySQL Connector,
it  brings up an input form with the parameters preloaded and a
connect button available.

Private Sub cmdConnectMySQL_Click()
 Dim cnMySql As New rdoConnection
 Dim rdoQry As New rdoQuery
 Dim rdoRS As rdoResultset

 ' set up remote data connection using the
 ' MySQL ODBC driver

 cnMySql.CursorDriver = rdUseOdbc

 'cnMySql.Connect = "uid=;pwd=;server=;" & "driver={MySQL ODBC 3.51
Driver};database=;dsn='';"

 'cnMySql.Connect = "uid=sysadmin;pwd=mypassword;server=localhost;" &
"driver={MySQL ODBC 3.51 Driver};database=simply;"

 'cnMySql.Connect = "Driver={MySQL ODBC 3.51
Driver};Server=localhost;Database=d:\mysql datafiles\data\ibdata1;
User=sysadmin;Password=sysadmin;Option=3;"

 cnMySql.Connect = "DRIVER={MySQL ODBC 3.51 Driver};" & _
                  "Server=localhost;" & _
                  "Port=3306;" & _
                  "Option=16384;" & _
                  "Stmt=;" & _
                  "Database=d:\mysql datafiles\data\ibdata1;" & _
                  "Uid=sysadmin;" & _
                  "Pwd=myPassword;"

 cnMySql.EstablishConnection

 cnMySql.Close

End Sub

Error Message form EstablishConnection:

Run-time error: 40002
S1000: [MySql][OBDC 3.51 Driver] Access denied for user
'sysadmin@localhost' (Using Password=Yes)

Unless you have the connector installed, you won't be able to
duplicate the problem.

Duke

ibdata1 is a reserved filename used by InnoDB to log table usage.

Use the ODBC connector, setup a system DSN and try to connect to *your* db.

/Henning
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.