Showing posts with label Oracle. Show all posts
Showing posts with label Oracle. Show all posts

Wednesday, 13 November 2013

Uninstall Oracle from Windows



Steps for uninstall Oracle from windows XP


Uninstall all Oracle components using the Oracle Universal Installer (OUI).
Run regedit.exe and delete the HKEY_LOCAL_MACHINE/SOFTWARE/Oracle key. This contains registry entires for all Oracle products.
If you are running 64-bit Windows, you should also delete the HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Oracle key if it exists.
Delete any references to Oracle services left behind in the following part of the registry (HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Ora*). It should be pretty obvious which ones relate to Oracle.
Reboot your machine.
Delete the "C:\Oracle" directory, or whatever directory is your ORACLE_BASE.
Delete the "C:\Program Files\Oracle" directory.
If you are running 64-bit Wiindows, you should also delete the "C:\Program Files (x86)\Oracle" directory.
Remove any Oracle-related subdirectories from the "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\" directory.
Empty the contents of your "C:\temp" directory.
Empty your recycle bin.

Wednesday, 3 April 2013

Generate Database Connection string ...Tricks


                  While connecting database through the programming.User needs to provide the connection string.

             Some times it is very difficult to remember the connection string.
1]create *.udl file 


2]Double Click on it



Provide your database related data
server Name and select the database

3]open that file in NotePad.
which will  give you the connection string 

Note :Please select provider first and generate the string

"SQL Server does not exist or access denied"

If you are facing

1]Error:- server does not exist or access denied

2]Error :- Changed database context to 'master'

3]SQLSTATE:0012A4D




Try out the following Solutions

1]Check the server name If you are providing this server name as connection string in the program 
then specify

hostname\\sqlexpress; as server name

instead  only hostname or hostname\sqlexpress.


2]Open port through the firewall
          Add port number (1433) and name in firewall

3]Open Run and type cliconfg
            select TCP/IP and enable 






4]Enable TCP/IP port


             Microsoft SQL Server-->configuration Tools-->SQL server configuration Manager










Connection string for the sql server 2008 is as follows





If only TCP/IP protocol is Enabled then provide the following string

"DRIVER={SQL Server};Provider=SQLOLEDB.1;server=hostname\\SQLEXPRESS;DATABASE=Database_name;";


If Shared memory ,Named Pipes are also enabled then

use network=DBMSSOCN; argument in the connection string
"DRIVER={SQL Server};Provider=SQLOLEDB.1;server=hostname\\SQLEXPRESS;network=DBMSSOCN;DATABASE=DatabaseName;


network=DBMSSOCN 


to use the TCP/IP protocol even if the Shared Memory or the Named Pipe protocols are available.





Wednesday, 19 December 2012

C to Oracle database connectivity

 Hello Friends,
                          Following information will give you step wise execution of the C program with oracle database in visual studio.


Open the Visual Studio ..

1] Creating new project
  •  Create new project .. 
  •  Select Win32 Console application. 
  •  Give the appropriate name.

2]Click on next


3]Select the Console application.

       Please uncheck the Precompiled headers.

  •      Click on Empty project


  •  Click on finish .. 
  •  It will create new project with empty folders in it 
  •  Add the new Item in source directory rename it as test.c or any *.c name.

Database Connection

1]Connect to database
  •   Go to the Tools 
  •   connect to the database option



2]Connect to the Data source Oracle..



3] Add connection

  •  Server name :your SID 
  •  Username :oracle username (system) 
  •  Password :oracle password(system)




4]Test the connection..
.

If it succeeded then do the further steps..or else you have problem in your database username/password or in SID


Project properties.. 
1]Right click on project 
  •  Choose option c/c++ 
  •  Add the Additional Directories.. 
                Here give the path upto include folder where your oracle is installed.




2]Go to the linker..and select the general option

 Add two path Additional libraries as :-
  • D:\oracle\product\10.2.0\db_1\OCI\lib;
  • D:\oracle\product\10.2.0\db_1\OCI\lib\MSVC"





3]select the input option

Add additional dependency as following path

  • D:\oracle\product\10.2.0\db_1\OCI\lib\MSVC\oci.lib



------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------


Save the following program as Test.c
       
        #include <stdlib.h>
#include <stdlib.h>
#include <ocidem.h>
#include <oratypes.h>
#include <ocidem.h>   
#define  VERSION_7 2
   
Lda_Def lda;
char hda[256];
Cda_Def cda;
   
void showError(Lda_Def* dataArea) 
         {
   
          char msg[512];   
           oerhms(&lda, dataArea->rc, msg, sizeof(msg));   
          printf("Error code   : %i \n", dataArea->rc);
          printf("Error message: %s \n", msg );   
           exit  (EXIT_FAILURE);   
}
   
  main()
      {
 
  char* sql = "INSERT INTO PEOPLE(NAME, AGE, BORN) VALUES
                              (:NAME, :AGE, TO_DATE(:BORN, 'DD.MM.YY HH24:MI:SS'))";

 char* name = "Apple";
 int   age  = 60;
 char* born = "15.03.1984 18:45:21";
 
 /* CONNECT TO DB */
          if (olog  (&lda, hda, "username", -1, "password", -1, "SID", -1, OCI_LM_DEF))       
           { showError(&lda); }
   
 /* CREATE CURSOR */ 
 if (oopen (&cda, &lda, 0, -1, -1, 0, -1))                            
          { showError(&cda); }
      
 /* PARSE SQL */
 if (oparse(&cda, sql, -1, 0, VERSION_7))                     
          { showError(&cda); }
 
 /* BIND VARIABLES */
 if (obndrv(&cda, ":NAME", -1, name, strlen(name)+1, STRING_TYPE, -1, 0, 0, -1, -1)) 
         { showError(&cda); }
 if (obndrv(&cda, ":AGE" , -1, &age, sizeof(int)   , INT_TYPE   , -1, 0, 0, -1, -1)) 
         { showError(&cda); }
 if (obndrv(&cda, ":BORN", -1, born, strlen(born)+1, STRING_TYPE, -1, 0, 0, -1, -1)) 
         { showError(&cda); }
   
         /* EXECUTE STATEMENT */
 if (oexec (&cda) && cda.rc != 1)                                         { showError(&cda); }
   
 /* COMMIT */
 if (ocom  (&lda))                                                               { showError(&cda); }

         /* CLOSE CURSOR */
 if (oclose(&cda))                                                                   { showError(&lda); } 

         /* CLOSE DB CONNECTION */
 if (ologof(&lda))                                                                   { showError(&lda); } 
   
     }
-----------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------

Build and run the above program.

Note:Before running above project ..Create the people table in the oracle database.
create table people(name char(20),age int ,born int);

Check the database by select * from people.


























Cool Blue Outer Glow Pointer