Going from SQLServer to Oracle - What do I need to do?

Last post 05-23-2007 8:06 AM by KJAK. 2 replies.

Sort Posts:

  • Going from SQLServer to Oracle - What do I need to do?

    05-21-2007, 3:59 PM
    • Participant
      751 point Participant
    • KJAK
    • Member since 03-14-2006, 12:07 PM
    • Posts 250

    I currently have an application that uses an SQLServer database. It has been decided that an Oracle database will be used in the production version. I need to update my application so that the connections point to an Oracle database.

     I have never used Oracle before. A DBA will be creating the database and providing me with the connection credentials.

    What all do I need to do in order to get my SQLServer application updated to run with Oracle instead?

    Do I still use the SQLClient? 

    Will my connection code still look like this:

     

     Dim conn As New SqlConnection(Connection.GetConn())
     Dim comm As New SqlCommand
     Dim SQL As String = ""
     Dim dr As SqlDataReader
     Dim err As String = ""
     Dim value As String = ""
    
            Using conn
                Try
                    SQL = String.Format("SELECT * FROM [TABLE]")
    
                    conn.Open()
    
                    comm.Connection = conn
                    comm.CommandType = Data.CommandType.Text
                    comm.CommandText = SQL
    
                    dr = comm.ExecuteReader
    
                    Do While dr.Read
                       value = dr("value")
                    Loop
                Catch ex As Exception
                    err = ex.Message
                Finally
                    conn.Close()
                End Try
            End Using

      ...?

    What does the connection string look like?

     

    ...Sorry complete n00b at Oracle!

    Thanks,
    KJAK

     

    Respect to the community...

    KJAK
  • Re: Going from SQLServer to Oracle - What do I need to do?

    05-22-2007, 1:50 AM
    Answer

    Migrating an application from SQL Server to Oracle will involve a lot more than changing the connection string, unless you have used Data Access Application Block (DAAB) . By the way, the connection string looks almost the same.

    <add name="ConnString" connectionString="Data Source=abc;user id=user;password=pass;min pool size=4;max pool size=100;"
       providerName="System.Data.OracleClient" />

    First of all, you will have to decide whether you want to use System.Data.OracleClient from Microsoft or Oracle.DataAccess from Oracle.

    Then, you will have to change all the Objects that begin with Sql to their equivalents in the Oracle library (beginning with Oracle) 

     e.g SqlConnection changes to OracleConnection

    Some other things that I can think of: 

    - remove [] from around the table names 

    - replace @param with :param in the parameters

    In case you get stuck with something specific, let me know.

    Refer to the following link for some help

    http://www.devx.com/dbzone/Article/20715 

    Regards,
    Prashant


    Dont forget to click "Mark as Answer" on the post that helped you.
  • Re: Going from SQLServer to Oracle - What do I need to do?

    05-23-2007, 8:06 AM
    • Participant
      751 point Participant
    • KJAK
    • Member since 03-14-2006, 12:07 PM
    • Posts 250

    I will review the recommended website, adjust my code accordingly, and test. If successful, I will mark your post as answer. Thank you.
     

    Respect to the community...

    KJAK
Page 1 of 1 (3 items)