Forum Stats

  • 3,817,330 Users
  • 2,259,314 Discussions
  • 7,893,751 Comments

Discussions

Registry Read

Prazy
Prazy Member Posts: 822 Silver Badge
edited Sep 24, 2009 3:32AM in SQL & PL/SQL
Hello All,

I wonder, is there any way to read registry entry using Oracle Stored Procedure?

Oracle DB: 11g R1

Regards,
Prazy
Tagged:

Best Answer

  • Billy Verreynne
    Billy Verreynne Software Engineer Member Posts: 28,807 Red Diamond
    Answer ✓
    An alternative is to make these Win32 calls via a Java stored proc. There are examples on the net available, but a quick google showed these mostly dealing with GUI calls and not standard calls to the kernel. But calling a DLL is calling a DLL so it should be possible.

    I would however in your shoes write my own wrapper DLL. This should be really a trivial exercise using something like Delphi. And then call that DLL via ext proc.
«1

Answers

  • Sven W.
    Sven W. Member Posts: 10,534 Gold Crown
    Problem is that a stored procedure runs on the database server.
    The registry is on the users client. To read this registry you would need some kind of client tool (at least a client command line).
    This client piece of software can then interact with the stored procedure.
    Sven W.
  • Prazy
    Prazy Member Posts: 822 Silver Badge
    Sven,

    Pardon me, forgot to mention that reg read should happen on DB server.

    Anyways from you reply I can guess that it cannot be done using PL/SQL or SQL.

    Is there any alternative like calling a VBscript inside a SP? I'm aware that it can be done on PL/SQL block.

    My need is to get the value while executing SP.

    Darn SQLServer does these things and my client now wants to migrate to Oracle. SQLServer is a piece of ****. ;)

    Any help is much appriciated.

    Prazy
  • user477000
    user477000 Member Posts: 144
    You can create .NET stored procedure....
    look at this forum 3256
    if you have any doubts.
  • BluShadow
    BluShadow Member, Moderator Posts: 41,896 Red Diamond
    Ok, so you want to migrate from SQL Server to Oracle.

    That doesn't mean that you should do things the same in Oracle as were done in SQL Server.

    e.g. just because SQL Server stored "information" in the registry, you don't have to do that with Oracle.

    Hey, I've got this great idea. Oracle gives you this thing called a "database". Apparently, it's designed for storing data and information. Perhaps you could use that? /sarcasm ;)
  • Billy Verreynne
    Billy Verreynne Software Engineer Member Posts: 28,807 Red Diamond
    edited Sep 3, 2009 6:33AM
    PrazY wrote:

    Anyways from you reply I can guess that it cannot be done using PL/SQL or SQL.
    It can - quite easily in fact. You can create an external stored procedure that calls the Win32 API directly that does the registry read.

    I do not use Windows (except as a gaming console), so unfortunately I cannot provide you with a Win32 example. I did a HP-UX example a while back in [this thread|http://forums.oracle.com/forums/thread.jspa?threadID=508978#1846991]

    The approach is basically identical for Win32. Define the DLL that contains the API call and use that. Also note that the local Oracle listener has to be configured for running extproc - to explain. To protect the integrity (especially memory) of the Oracle server process, the external procedure call is made by an external process (transparently as far as the app developer is concerned). However, for the external process to be spawned, the Oracle Listener needs to be correctly configured.

    --
    Billy +(whose forum handle is screwed up again - thanks Jives!)+
    Billy Verreynne
  • Billy Verreynne
    Billy Verreynne Software Engineer Member Posts: 28,807 Red Diamond
    BluShadow wrote:

    e.g. just because SQL Server stored "information" in the registry, you don't have to do that with Oracle.
    The Windows Registry is The Single Biggest Point Of Ultimate And Total Failure in Windows.

    I remember sitting in a workshop with other vendors and with a NT product manager (prior to NT 3.0) on the new NT o/s. He went on and on about the awesomeness of the Registry. About how all configuration data is stored there, what an excellent repository it is (at which time one of the vendors asked him if ISVs can use it as a database then)...

    At the time I was not very comfortable with the concept. Quite use to the +/etc+ directory and +.conf+ files on Unix. And the +.ini+ files in the +\windows+ directory for Win3.1 and WFW3.11.

    Time and time again I have seen how a complete Windows system become a piece of scrap due to corruption in the registry.. or simply due to a incorrect configuration parameter.

    And guess where does a lot of virusses and worms hang out to be started by Windows at boot time.. in the registry.

    Still cannot understand how such an utterly flawed and totally [email protected] idea could have been implemented into the Windows operating system.
  • BluShadow
    BluShadow Member, Moderator Posts: 41,896 Red Diamond
    Totally agree Billy.

    I can see the "idea" that they had, what with applications storing their .ini files all over the hard disk and not sticking to any consistent format, making it hard for people to "tweak" the configurations.

    What they should have done was provided an INI DLL file that you could use to set, read and configure INI files and Windows just looked after the files in a central directory. If one of them became corrupt, it wouldn't have boogered up the rest.

    I guess there must have been some Java developer got in there, thinking it was a good idea to just chuck everything in one bucket. ;)
    BluShadow
  • Prazy
    Prazy Member Posts: 822 Silver Badge
    edited Sep 3, 2009 7:23AM
    I totally agree with you Shadow, But the front end covers-up with registry and I do not have control over changing the front end code in fact. As for as I concern, I would like to make Oracle as best DB for the application compared to SQL Server.

    But still client insist to migrate DB alone, So I do not have any other go. :(

    @Billy: I had a good laugh, Yes it is true indeed. Windows are totally [email protected] but still layman finds it user friendly and Bill made profit out of it.. we cannot insist others on their doing; atleast for the matter of fact I would like to hold the grip on my project rather asking my client to change the OS :)

    Anyways thanks for your suggestion. I'll look into API calls and will check what can be done with that.

    Regards,
    Prazy
  • Billy Verreynne
    Billy Verreynne Software Engineer Member Posts: 28,807 Red Diamond
    Found an example.. recalled that Tom posted a wrapper proc for GetPrivateProfileString (Win32 call that provides backwards INI compatibility for the Registry).

    Have a look at [this thread|http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:21419917814146] on asktom.com.
    Billy Verreynne
  • MichaelS
    MichaelS Member Posts: 8,424 Bronze Crown
    I wonder, is there any way to read registry entry using Oracle Stored Procedure?
    I'd write a small Java Stored Procedure utilizing java.util.prefs.Preferences (from 10g on) as e.g. in
    How do I read / write data in Windows registry?.
    MichaelS
This discussion has been closed.