Connecting To Sql

Hello,

I Am Having Difficuly Finding A Detailed Tutorial On How To Connect VB6 With SQL. I Have Used Mysql Through Php, But Never VB.

This Application I Am In The Middle Of Making Will Be Ran On A Domain Server (Win 2k Server), And Multiple Clients Will Need To Connect To It.

My First Question Is, What Needs To Be Set Up On The Client Computers?

The Second Question Is, If The Domain Computer Is Windows 2k, Can My App Connect To An Sql Server That Is On An Alternate Machine (Linux 7.3)?

Any Suggestions Or Comments You Have Would Be Very Appreciated. If You Know Of Any GOOD Tutorials, Please Let Me Know As Well.

Even If I Do Get My Questions Answered, I Feel I'm Gonna Have A Lot More Work Ahead Of Me.

Thanks In Advance,

Cory
«1

Comments

  • : Hello,
    :
    : I Am Having Difficuly Finding A Detailed Tutorial On How To Connect VB6 With SQL. I Have Used Mysql Through Php, But Never VB.
    :
    : This Application I Am In The Middle Of Making Will Be Ran On A Domain Server (Win 2k Server), And Multiple Clients Will Need To Connect To It.
    :
    : My First Question Is, What Needs To Be Set Up On The Client Computers?
    :
    : The Second Question Is, If The Domain Computer Is Windows 2k, Can My App Connect To An Sql Server That Is On An Alternate Machine (Linux 7.3)?
    :
    : Any Suggestions Or Comments You Have Would Be Very Appreciated. If You Know Of Any GOOD Tutorials, Please Let Me Know As Well.
    :
    : Even If I Do Get My Questions Answered, I Feel I'm Gonna Have A Lot More Work Ahead Of Me.
    :
    : Thanks In Advance,
    :
    : Cory
    :
    First of all. Could you stop to type all words starting from capital letter? I don't know how other people like it but I personnaly find quite annoying to read text like that.
    Now about connection.
    Do not worry about differences between OS of domain and server machine
    Go to Project - References and select Microsoft ActiveX DataObject 2.5/2.6 Library
    Then try this. UserID and Password are optional but if user use them make sure, you know them
    [code]
    Dim cn As New ADODB.Connection
    Dim strConn as String

    strConn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID= ;Password= ; " & _
    "Initial Catalog=MYCATALOG,Data Source=MYDATASOURCE"
    'Data Source - server name
    'Catalog - database name

    cn.Open strConn

    [/code]
    The foolowing links contain some very useful information
    http://www.devguru.com/Technologies/ado/quickref/ado_intro.html
    http://www.able-consulting.com/ADO_Conn.htm
  • : Now about connection.
    : Do not worry about differences between OS of domain and server
    : machine
    While that is true, you do need to worry about whether you have the driver for using a MySQL database with ADO or ODBC. This does not come as standard, and will need to be installed on the client PCs.

    You will need MySQLODBC and/or MyOLEDB (MySQLProv) and you can find more info at:-
    http://www.mysql.com/downloads

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • you do need to worry about whether you have the driver for using a MySQL database with ADO or ODBC. This does not come as standard, and will need to be installed on the client PCs.
    :
    : You will need MySQLODBC and/or MyOLEDB (MySQLProv) and you can find more info at:-
    :
    I've never used MySQL, but if you are using SQL Server and client machine is Windows 95/98/NT or 2000 you should not be worry about SQL Server OLEDB or ODBC drivers. They are coming together with Windows
  • : I've never used MySQL, but if you are using SQL Server and client
    : machine is Windows 95/98/NT or 2000 you should not be worry about
    : SQL Server OLEDB or ODBC drivers. They are coming together with
    : Windows
    MySQL was mentioned in the question, and as it also mentioned the SQL database was on Linux...well...it won't be (MS) SQL Server. :-) Though it wasn't entirely clear.

    In summary: MS SQL Server and MS Access (?) - no additional drivers needed
    MySQL - you need to install the driver.

    Jonathan

    ###
    for(74,117,115,116){$::a.=chr};(($_.='qwertyui')&&
    (tr/yuiqwert/her anot/))for($::b);for($::c){$_.=$^X;
    /(p.{2}l)/;$_=$1}$::b=~/(..)$/;print("$::a$::b $::c hack$1.");

  • [b][red]This message was edited by kel1981b at 2003-10-30 9:37:24[/red][/b][hr]
    : MySQL was mentioned in the question, and as it also mentioned the SQL database was on Linux...well...it won't be (MS) SQL Server. :-) Though it wasn't entirely clear.
    :
    That's right but Cory also said "Can My App Connect To An [b]Sql Server That..." [/b]. I thought he used to use PHP and MySQL and now going to work with VB - SQL Server. So, I am confused what DB he is going to use. Anyway, you summary is correct.


  • : [b][red]This message was edited by kel1981b at 2003-10-30 9:37:24[/red][/b][hr]
    : : MySQL was mentioned in the question, and as it also mentioned the SQL database was on Linux...well...it won't be (MS) SQL Server. :-) Though it wasn't entirely clear.
    : :
    : That's right but Cory also said "Can My App Connect To An [b]Sql Server That..." [/b]. I thought he used to use PHP and MySQL and now going to work with VB - SQL Server. So, I am confused what DB he is going to use. Anyway, you summary is correct.
    :
    :
    :

    Sorry For The Confusion.
    I Am Going To Try And Use A Mysql Server Running On Linux, With The Main App On A Seperate Windows Domain Server.

    Thanks For The Quick Replies.

    P.S.....The Cap Thing Is A Bad Habbit
  • : : Hello,
    : :
    : : I Am Having Difficuly Finding A Detailed Tutorial On How To Connect VB6 With SQL. I Have Used Mysql Through Php, But Never VB.
    : :
    : : This Application I Am In The Middle Of Making Will Be Ran On A Domain Server (Win 2k Server), And Multiple Clients Will Need To Connect To It.
    : :
    : : My First Question Is, What Needs To Be Set Up On The Client Computers?
    : :
    : : The Second Question Is, If The Domain Computer Is Windows 2k, Can My App Connect To An Sql Server That Is On An Alternate Machine (Linux 7.3)?
    : :
    : : Any Suggestions Or Comments You Have Would Be Very Appreciated. If You Know Of Any GOOD Tutorials, Please Let Me Know As Well.
    : :
    : : Even If I Do Get My Questions Answered, I Feel I'm Gonna Have A Lot More Work Ahead Of Me.
    : :
    : : Thanks In Advance,
    : :
    : : Cory
    : :
    : First of all. Could you stop to type all words starting from capital letter? I don't know how other people like it but I personnaly find quite annoying to read text like that.
    : Now about connection.
    : Do not worry about differences between OS of domain and server machine
    : Go to Project - References and select Microsoft ActiveX DataObject 2.5/2.6 Library
    : Then try this. UserID and Password are optional but if user use them make sure, you know them
    : [code]
    : Dim cn As New ADODB.Connection
    : Dim strConn as String
    :
    : strConn = "Provider=SQLOLEDB.1;Persist Security Info=False;User ID= ;Password= ; " & _
    : "Initial Catalog=MYCATALOG,Data Source=MYDATASOURCE"
    : 'Data Source - server name
    : 'Catalog - database name
    :
    : cn.Open strConn
    :
    : [/code]
    : The foolowing links contain some very useful information
    : http://www.devguru.com/Technologies/ado/quickref/ado_intro.html
    : http://www.able-consulting.com/ADO_Conn.htm
    :

    [Quote]Go to Project - References and select Microsoft ActiveX DataObject 2.5/2.6 Library [/Quote]

    I Looked....... Reference Is Not There
  • :
    : [Quote]Go to Project - References and select Microsoft ActiveX DataObject 2.5/2.6 Library [/Quote]
    :
    : I Looked....... Reference Is Not There
    :
    Look like I misspell name it must be [b]Microsoft ActiveX Data Objects [/b] and library could be from 2.0 to 2.6 depends of what kind of Visual Studio do you have. It could be also 2.7 I guess, more latest edition. Check you machine for msado15.dll. Normally, it's installed at C:Program FilesCommon FilesSystemADO
  • Okay.....I Set Up An Sql Server On This Local Machine.

    I've Tested The Connection With The Following Code:

    oConn.Open "Provider=sqloledb;" & _
    "Data Source=(local);" & _
    "Initial Catalog=mysql;" & _
    "User ID=root;" & _
    "Password="


    Now I Am Getting The Following Error....

    [DBNETLIB][ConnectionOpen (Connect()).] SQL Server Does Not Exist Or Access Is Denied.

    I Got This Error When Trying Locally, And Across The Network.

    Any Ideas On What May Be Wrong?

    Thanks,

    Cory
  • [b][red]This message was edited by kel1981b at 2003-10-30 12:55:14[/red][/b][hr]
    : Okay.....I Set Up An Sql Server On This Local Machine.
    :
    : I've Tested The Connection With The Following Code:
    :
    : oConn.Open "Provider=sqloledb;" & _
    : "Data Source=(local);" & _
    : "Initial Catalog=mysql;" & _
    : "User ID=root;" & _
    : "Password="
    :
    :
    : Now I Am Getting The Following Error....
    :
    : [DBNETLIB][ConnectionOpen (Connect()).] SQL Server Does Not Exist Or Access Is Denied.
    :
    : I Got This Error When Trying Locally, And Across The Network.
    :
    : Any Ideas On What May Be Wrong?
    :
    : Thanks,
    :
    : Cory
    :
    I am still confused what Database you are using. Is it Microsoft SQL Server or it's MySQL? If you're using MySQL, I do not know.

    If it's SQL Server, it means "mysql" server does not excist. I think you messed up with Database and server. Why did you name Database "(local)"? I think your connection string has to look like that
    [code]
    "Provider=sqloledb;" & _
    "Data Source=mysql;" & _
    "Initial Catalog=(local);" & _
    "User ID=root;" & _
    "Password="
    [/code]

  • Okay....... Sorry If I Am Wording Things Wrongly, Or Not Giving Enough Information.

    I Have Tried To Connect To:
    1.A Mysql Server Running On A Network Machine (Running Linux 7.3)

    oConn.Open "Driver={SQL Server};" & _
    "Address=192.168.0.2,1433;" & _
    "Network=DBMSSOCN;" & _
    "Database=mysql;" & _
    "Uid=root;" & _
    "Pwd=myPassword"


    2.A Mysql Server Running On A Local Machine

    oConn.Open "Driver={SQL Server};" & _
    "Server=(local);" & _
    "Database=mysql;" & _
    "Uid=root;" & _
    "Pwd="


    In Both Cases I Get The Error:

    [DBNETLIB][ConnectionOpen (Connect()).] SQL Server Does Not Exist Or Access Is Denied.

    I'm Stumped..... I Know There Is A Server Running Because I Can Do Sql Statements From Dos / Console, And They Work Fine (On Both Machines).


    Any More Suggestions?

    Thanks Once Again,

    Cory
  • : Okay....... Sorry If I Am Wording Things Wrongly, Or Not Giving Enough Information.
    :
    : I Have Tried To Connect To:
    : 1.A Mysql Server Running On A Network Machine (Running Linux 7.3)
    :
    Sory Cory, I know nothing about MySQL. Wait for Jonothan or somebody else with that kind of experience.
  • : Okay....... Sorry If I Am Wording Things Wrongly, Or Not Giving Enough Information.
    :
    : I Have Tried To Connect To:
    : 1.A Mysql Server Running On A Network Machine (Running Linux 7.3)
    :
    : oConn.Open "Driver={SQL Server};" & _
    : "Address=192.168.0.2,1433;" & _
    : "Network=DBMSSOCN;" & _
    : "Database=mysql;" & _
    : "Uid=root;" & _
    : "Pwd=myPassword"
    :
    :
    : 2.A Mysql Server Running On A Local Machine
    :
    : oConn.Open "Driver={SQL Server};" & _
    : "Server=(local);" & _
    : "Database=mysql;" & _
    : "Uid=root;" & _
    : "Pwd="
    :
    Like I said before, I know nothing about MySQL but example of connection string that I found on http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#OLEDBProviderForMySQL
    looks very different from yours. May be that will help

  • I Got VB To Connect To Mysql Using The Following:

    Dim dbConnect As ADODB.Connection
    Set dbConect = New ADODB.Connection
    Dim rs As New ADODB.Recordset
    dbConect.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _
    & "SERVER=192,160,0,2;" _
    & "DATABASE=mysql;" _
    & "UID=root;" _
    & "PWD=;" _
    & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 16384

    Thanks For The Quick Replies.

    If You Know Of Any Good Places That Explain How To Manage Data In A Mysql Server From VB.....I'd Appreciate

    Thanks Again,

    Cory
  • :
    : If You Know Of Any Good Places That Explain How To Manage Data In A Mysql Server From VB.....I'd Appreciate
    :
    : Thanks Again,
    :
    : Cory
    :
    Try this
    http://www.mysql.com/products/myodbc/manual.html#Connector_ODBC_With_VB
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories