Showing posts with label compatibility. Show all posts
Showing posts with label compatibility. Show all posts

Tuesday, May 27, 2008

Learn EDB: Basic Encryption

LewisC's An Expert's Guide To Oracle Technology


An ITToolbox user recently asked a question on the EnterpriseDB discussion group, Oracle equilant UTL_I18N.STRING_TO_RAW IN ENTERPRISEDB.


Basically, Sreenivas asked which functions in EnterpriseDB could be used to implement dbms_crypto, hex_to_raw, string_to_raw, etc. I believe he is using EnterpriseDB Postgres Plus Advanced Server which is the product that gives Oracle Compatibility. The short answer to his question is that right now, there are no compatibility functions for those. The long answer is that you can re-implement that functionality using native PG functionality.


If you look at Sreenivas's message you can see how his existing code works. I posted a simple example in response which I am reposting below. The PG docs suggest that you use PGP based encryption rather than what they call raw encryption. I think it depends on exactly what you're doing, personally. Anyway, raw encryption was closer to what Sreenivas was doing so that was what I based my example on.


I've used DBMS_CRYPTO in Oracle quite a bit but this is my first use of encrypt/decrypt in PG. If you have any suggestions for improving it, I'd like to hear them.


Hi Sreenivas,




I saw your post on the edb forum but and planned to write a blog entry on this topic.


The thing is that there isn't a one to one translation in EDB yet. The easiest thing is to rewrite your procedure and use built-ins that are available.




It is recommended that you use the PGP function in postgres as opposed to the raw encryption functions for better security. However, raw encryption more closely matches what you are trying to do. Below is an example of using raw encryption with AES.


You don't need to convert to hex as you'll be using bytea which is easily converted from and to a string. If you really need international support, check out the pg decode function (which is different from Oracle's decode). http://www.postgresql.org/docs/current/static/funct ions-string.html




Here is a very simple example that you can use to build your procedure:



declare

original_data text := 'I am going to be encrypted';
data bytea;
cipher bytea;
crypto_type text;
encrypted_data bytea;
final_string text;

begin

-- conversion to bytea, could use cast too
data := original_data;

--set cipher key
cipher := 'not a strong key, use pgp instead';

-- select type: aes or blowfish (bf)
crypto_type := 'aes';

-- encrypt the data
select encrypt(data, cipher, crypto_type) into encrypted_data;

dbms_output.put_line('Encrypted: ' || encrypted_data );

-- decrypt the data
select decrypt(encrypted_data, cipher, crypto_type) into final_string;

dbms_output.put_line('Decrypted: ' || final_string );

end;

Hope this helps,


LewisC




Del.icio.us : , , ,

Tuesday, December 25, 2007

Compatibility Between EntepriseDB and Oracle

Have you wondered what features are compatible between Oracle and EnterpriseDB? Have you wondered if EnterpriseDB is REALLY compatible with Oracle?

EnterpriseDB has compiled a new document called the Oracle Compatibility Developer's Guide. You can download the Oracle Compatibility Developer's Guide for EntepriseDB 8.2 or the Oracle Compatibility Developer's Guide for 8.3 Beta.

This new document should help answer one of the most common questions I get asked, i.e., what is compatible and what is not compatible between EnterpriseDB and Oracle. If you are interested in EnterpriseDB but haven't taken the plunge, check out this document.

Speaking of compatibility, I plan to start a series of articles that directly compares a feature between Oracle and EntepriseDB (with mentions to pure PostgreSQL).

LewisC




Sunday, November 18, 2007

EDB*Plus and EDB*Loader Emulate Oracle’s SQL*Plus and SQL*Loader: EnterpriseDB 8.3 Beta

EnterpriseDB Advanced Server’s enterprise-class, cross-platform developer and DBA console now includes EDB*Plus, a command-line terminal interface that emulates Oracle’s SQL*Plus. Like SQL*Plus, EDB*Plus allows users to run SQL and PL/SQL commands interactively. Oracle users accustomed to SQL*Plus will find EDB*Plus immediately familiar. In addition, EnterpriseDB’s new EDB*Loader emulates Oracle’s SQL*Loader and provides even deeper compatibility.

EnterpriseDB Advanced Server 8.3 adds several new features that enhance the database’s ability to run, unchanged, applications written for Oracle. For example, there are more than 20 new Oracle-compatible system views, Oracle-compatible packages now support comments, and ROWNUM can now be used in sub-queries and views. In addition, EnterpriseDB’s new bulk binding feature, which allows collections of SQL statements to be collected and run together to improve performance, further improves Oracle compatibility.

Other updates to the new software include:

  • A DBA monitoring console that provides real-time charting for CPU and memory usage, disk I/O, and cache hit ratios across multiple EnterpriseDB databases
  • Support for embedded hints, which can alter program execution
  • Transaction error recovery support, which enables implicit statement-level transactions
  • Updateable cursors
  • Definer/invoker rights to provide controlled access to database objects



Sunday, August 19, 2007

EnterpriseDB Compatibilty features

A question that I am asked very often it exactly what features are compatible between EnterpriseDB and Oracle. The short story is that the areas that you think of as "development", i.e. SQL, Code, etc are the areas where the compatibility exists.

Maintenance tasks are generally familiar as is the overall architecture. Any modern database will have logging, recovery, backups, etc. In EnterpriseDB, the way you code an application will be compatible with Oracle and the maintenance of an EnterpriseDB database will be familiar.

EnterpriseDB has published a white paper called, Delivering Oracle Compatibility. This paper outlines the exact points of compatibility very succinctly. I hope they keep it updated for each release.

This bulleted list from the white paper outlines it pretty well:

  • Oracle SQL Compatibility. EnterpriseDB Advanced Server executes Oracle-specific SQL syntax.
  • PL/SQL Compatibility. EnterpriseDB Advanced Server executes PL/SQL, Oracle’s unique language for triggers, stored procedures, packages, and functions.
  • Data Dictionary Views. EnterpriseDB provides the most common Oracle catalog views.
  • Programming Flexibility and Drivers. EnterpriseDB supports the most common programming languages used to create database applications for Oracle including compatibility and interoperability with the Oracle Call Interface (OCI)™.
  • Migration Tools. EnterpriseDB provides a suite of automated tools to move Oracle data, packages, triggers, stored procedures, and functions to EnterpriseDB in one simple step.
  • Replication. EnterpriseDB Replication Server can replicate Oracle databases in near real-time to: improve database performance, run reporting and as the foundation for other applications at a small fraction of Oracle’s cost.
  • Enterprise-Class Reliability and Scalability. EnterpriseDB Advanced Server is a suitable replacement for Oracle in high-volume, mission-critical applications.
  • Oracle-Like Tools. EnterpriseDB Advanced Server includes a robust set of integrated tools that will be familiar to professional Oracle DBAs and developers.
The white paper lists specific functions and features that are Oracle compatible. If you are considering EnterpriseDB, you should read it. The one thing it doesn't list are those items that ARE NOT compatible, i.e. missing functions, incompatible syntax, data types issues. Fortunately, you can find those in my book. ;-)

LewisC




Software Blogs - Blog Catalog Blog Directory Software blogs Top Blog Sites Blog Flux Directory Lewis Cunningham