Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Connection string in VB.Net 2003

Connection string in VB.Net 2003

Scheduled Pinned Locked Moved Visual Basic
csharpdatabaseoracle
11 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kendo17
    wrote on last edited by
    #1

    Hi All:confused: I am trying to connect to my database from the front end in VB.NET 2003, the connection strings that i have tried are not working at present. I have VB.NET 2003 program from last year but that was using access as the back end and VB.NET 2003 as the front end. This year i must use oracle as the back end and Vb.Net 2003 as the front end. The connection strings that i have tried do not seem to be correct but i will keep trying it is probably something simple. Yes the database does connect through odbc and the tns file is correct

    D A 2 Replies Last reply
    0
    • K kendo17

      Hi All:confused: I am trying to connect to my database from the front end in VB.NET 2003, the connection strings that i have tried are not working at present. I have VB.NET 2003 program from last year but that was using access as the back end and VB.NET 2003 as the front end. This year i must use oracle as the back end and Vb.Net 2003 as the front end. The connection strings that i have tried do not seem to be correct but i will keep trying it is probably something simple. Yes the database does connect through odbc and the tns file is correct

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      WIthout seeing any code for the connection string, or an error descriptions, about all anyone can do is point you at ConnectionStrings.com[^].

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      K 1 Reply Last reply
      0
      • D Dave Kreskowiak

        WIthout seeing any code for the connection string, or an error descriptions, about all anyone can do is point you at ConnectionStrings.com[^].

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        K Offline
        K Offline
        kendo17
        wrote on last edited by
        #3

        the code is Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ctoracleConnection As OleDbConnection Dim ctoracleCommand As OleDbCommand Dim dataRow As OleDbDataReader 'MSDORA is the provider when working with Oracle ctoracleConnection = New OleDbConnection("Provider=MSDAORA.1;User ID=oracle username;password=orac le password; data source=ctoracle") 'opens the connection ctoracleConnection.Open() 'executes the command and assigns it to the connection ctoracleCommand = New OleDbCommand("Select EName from emp", ctoracleConnection) dataRow = ctoracleCommand.ExecuteReader() While dataRow.Read() 'displays data from the table MessageBox.Show("Employee Name" & " " & dataRow(0)) End While dataRow.Close() ctoracleConnection.Close() End Sub End Class _______________________________________________________________________________________________________________________________

        D 1 Reply Last reply
        0
        • K kendo17

          the code is Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim ctoracleConnection As OleDbConnection Dim ctoracleCommand As OleDbCommand Dim dataRow As OleDbDataReader 'MSDORA is the provider when working with Oracle ctoracleConnection = New OleDbConnection("Provider=MSDAORA.1;User ID=oracle username;password=orac le password; data source=ctoracle") 'opens the connection ctoracleConnection.Open() 'executes the command and assigns it to the connection ctoracleCommand = New OleDbCommand("Select EName from emp", ctoracleConnection) dataRow = ctoracleCommand.ExecuteReader() While dataRow.Read() 'displays data from the table MessageBox.Show("Employee Name" & " " & dataRow(0)) End While dataRow.Close() ctoracleConnection.Close() End Sub End Class _______________________________________________________________________________________________________________________________

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          And the exception message??

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          K 1 Reply Last reply
          0
          • D Dave Kreskowiak

            And the exception message??

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            K Offline
            K Offline
            kendo17
            wrote on last edited by
            #5

            An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim derbyConnection As OleDbConnection Dim derbyCommand As OleDbCommand Dim dataRow As OleDbDataReader 'MSDORA is the provider when working with Oracle derbyConnection = New OleDbConnection("Provider=MSDAORA.1;User ID=oracle ken;password=tigger; data source=derby.com") 'opens the connection derbyConnection.Open() '''''the code falls over here 'executes the command and assigns it to the connection derbyCommand = New OleDbCommand("Select EName from emp", derbyConnection) dataRow = derbyCommand.ExecuteReader() While dataRow.Read() 'displays data from the table MessageBox.Show("Employee Name" & " " & dataRow(0)) End While dataRow.Close() derbyConnection.Close() End Sub dave thanks for your help beforehand

            D 1 Reply Last reply
            0
            • K kendo17

              Hi All:confused: I am trying to connect to my database from the front end in VB.NET 2003, the connection strings that i have tried are not working at present. I have VB.NET 2003 program from last year but that was using access as the back end and VB.NET 2003 as the front end. This year i must use oracle as the back end and Vb.Net 2003 as the front end. The connection strings that i have tried do not seem to be correct but i will keep trying it is probably something simple. Yes the database does connect through odbc and the tns file is correct

              A Offline
              A Offline
              AliAmjad
              wrote on last edited by
              #6

              Try the Oracle Managed Provider for .NET and then use the Connection String this will improve the performance of your application. AliAmjad (MCP)

              1 Reply Last reply
              0
              • K kendo17

                An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim derbyConnection As OleDbConnection Dim derbyCommand As OleDbCommand Dim dataRow As OleDbDataReader 'MSDORA is the provider when working with Oracle derbyConnection = New OleDbConnection("Provider=MSDAORA.1;User ID=oracle ken;password=tigger; data source=derby.com") 'opens the connection derbyConnection.Open() '''''the code falls over here 'executes the command and assigns it to the connection derbyCommand = New OleDbCommand("Select EName from emp", derbyConnection) dataRow = derbyCommand.ExecuteReader() While dataRow.Read() 'displays data from the table MessageBox.Show("Employee Name" & " " & dataRow(0)) End While dataRow.Close() derbyConnection.Close() End Sub dave thanks for your help beforehand

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #7

                The Provider in the connection string should be just "MSDAORA", drop the ".1" part. I also don't know if putting a period in the database name is legal, nor do I know if putting a space in the User Id, "oracle ken", is legal either. OleDb is a kind of "generic" database interface. Like the other poster said, you'd get much better performance if you used the OPD.Net provider instead. This will, of course, require a rewrite of your code.

                A guide to posting questions on CodeProject[^]
                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                     2006, 2007

                K 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  The Provider in the connection string should be just "MSDAORA", drop the ".1" part. I also don't know if putting a period in the database name is legal, nor do I know if putting a space in the User Id, "oracle ken", is legal either. OleDb is a kind of "generic" database interface. Like the other poster said, you'd get much better performance if you used the OPD.Net provider instead. This will, of course, require a rewrite of your code.

                  A guide to posting questions on CodeProject[^]
                  Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                       2006, 2007

                  K Offline
                  K Offline
                  kendo17
                  wrote on last edited by
                  #8

                  when opening server explorer should the oracle database not be displayed there for me to point to and then test. As the database is not showing there. I tried database connection with my access and it connected successfully but will not connect to the oracle database but it is not displayed in the server explorer.:confused:

                  D 1 Reply Last reply
                  0
                  • K kendo17

                    when opening server explorer should the oracle database not be displayed there for me to point to and then test. As the database is not showing there. I tried database connection with my access and it connected successfully but will not connect to the oracle database but it is not displayed in the server explorer.:confused:

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #9

                    kendo17 wrote:

                    when opening server explorer should the oracle database not be displayed there for me to point to and then test. As the database is not showing there.

                    The provider and credentials have to be correct in order for it to connect to the server and get the list of databases. The credentials also have to have permissions in the Oracle server to get that list. I don't know exactly what has to happen on the Oracle server, since I've never used Oracle, nor do I want to.

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                         2006, 2007

                    A 1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      kendo17 wrote:

                      when opening server explorer should the oracle database not be displayed there for me to point to and then test. As the database is not showing there.

                      The provider and credentials have to be correct in order for it to connect to the server and get the list of databases. The credentials also have to have permissions in the Oracle server to get that list. I don't know exactly what has to happen on the Oracle server, since I've never used Oracle, nor do I want to.

                      A guide to posting questions on CodeProject[^]
                      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                           2006, 2007

                      A Offline
                      A Offline
                      aransiola
                      wrote on last edited by
                      #10

                      Oracle & SQL Server Databases are server-based database. They are not Filedatabase like Microsoft Access. So they cannot be open like you open ur access db file. The Oracle Database like SQL Server has an Enterprise Console where you can manage the database t.aransiola

                      D 1 Reply Last reply
                      0
                      • A aransiola

                        Oracle & SQL Server Databases are server-based database. They are not Filedatabase like Microsoft Access. So they cannot be open like you open ur access db file. The Oracle Database like SQL Server has an Enterprise Console where you can manage the database t.aransiola

                        D Offline
                        D Offline
                        Dave Kreskowiak
                        wrote on last edited by
                        #11

                        And you're telling me this why??? I know that, and your answer has nothing to do with the problem.

                        A guide to posting questions on CodeProject[^]
                        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                             2006, 2007

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups