Saturday, March 31, 2012

Oracle 11g Determining the database characteristics


For transportable table spaces you need to make sure your source and target databases are compatible.
If the target does not have the same endian format yo need to convert the tablespace contents. You can find out the endian types of supported Oracle database platforms  using this query.
select platform_id, platform_name, endian_format
 from v$transportable_platform
 order by endian_format, platform_ID;
This query returns the character set  for your platform (Note the first two lines do some column formatting. I like to use WOR, short for WORD WRAP, to make more readable text)
COLUMN my_platform FORMAT A24 WOR
COLUMN my_endian_format FORMAT  A24 WOR
select platform_name my_platform,
  endian_format my_endian_format
  from v$transportable_platform
  join v$database using(platform_name);
This query returns the NLS_CHARACTERSET (Database Character Set) and the NLS_NCHAR_CHARACTERSET (National Character Set ) for your database
select *
 from v$nls_parameters
 where parameter like ('%CHARACTERSET');

Wednesday, January 18, 2012

AirPort Extreme error solved

It took me half a day to figure this out so I thought I'll just post the solution here. Maybe it will help someone. Here's the solution summary

Problem: Win 7 and Win XP  computers cannot connect to AirPort Extreme wireless signal. The light on the front of the AirPort Extreme base station is flashing amber.
Solution:  Upgrade your AirPort utility and install a firmware upgrade to the AirPort Extreme base station.

My story

Here I am staying at a friends house while he is away on a trip and his AirPort Extreme wireless router stops working. What happens first is my  XP computer won't connect to the signal. I try rebooting the modem and the router by unplugging them and they still won't connect. I see though  the and the light on the front of the  AirPort box  flashes amber.  I check all the cables. they're OK. I call my friend and we talk it over. Here's what I finally did that worked

Turns out I could connect to the Internet using a cable. Not only directly to the modem but also with the modem  and my computer both connected to the AirPort box. so I know the modem is working. Whew!

I don't own a Mac. I have two machines one with Win XP and the other that dual boots between Ubuntu and Win 7. So I download the Airport Utility for Windows and the user manual.

Here is what the manual says:
Your AirPort Extreme Status Light Flashes Amber
  • The Ethernet cable may not be connected properly, 
  • AirPort Extreme may be out of range of an AirPort network, or 
  • there may be a problem with your Internet servicemay have lost its connection to the network or the Internet. 
No, it's none of these. Warning: If you press the little button on the back of the box you reset the box to factory settings and the signal is unsecured. Oops
Even if the modem seems to be working properly, try disconnecting the modem from its power supply, waiting a few seconds, and then reconnecting it. Make sure AirPort Extreme is connected directly to the modem via Ethernet before reconnecting power to the modem.
Already tried that but it did not help.
For more information about the reason the light flashes, open AirPort Utility, select your base station, and then choose Manual Setup from the Base Station menu. The information about the flashing light is displayed on the Summary pane. provider. 
Great. I install the AirPort Utility. Tip: The  AirPort Utility may take a long time to install on Win 7.


After getting it installed however it would not display information on the AirPort base station. Even though it seemed to recognize the base station, when I clicked the Manual setup button it gave a could not connect error. But I notice it says there is an upgrade. I just downloaded this software from the Apple site. why do I need to upgrade? But alright, I'll try that.

During the new installation process a Windows firewall box appears. I click it to allow the AirPort utility through the firewall and realize maybe that is why the original installation did not connect properly to the base station. Now the AirPort Utility  connects to the base station and says it needs a firmware upgrade. Great. I click through that. But the light is still flashing.

Now I  reset the connection name and WEP password to what it was before.

The light turns Green. Yeah!



Tuesday, December 13, 2011

Text encoding transformations

In PHP there are several text encoding transformation that are useful for different purposes.
If you use the GET method, you can make it safer if you pass you Get variable using
  • rawurlencode: Use if you have spaces in the main part of the URL. Replaces non alpha-numeric characters with %ASCII code
  • urlencode: Used in the query part of a URL, or to pass GET variables. Replaces spaces with +
  • htmlspecialcharacters:  Use to prevent user-supplied text from containing HTML markup. Does minimal conversion of HTML characters:  " < > & ' to &XXXX; equivalent
  • htmlentities: Used to prevent user-supplied text from adding any malicious code. Converts all characters with an &...; equivalent.
  • strip_tags: Use to prevent user-supplied text from containing unallowed HTML markup.
  • nl2br: Use to preserve line breaks in user-supplied text.
Example:  Passing on a query
'<a href= "http://www.google.com/?q="'.urlencode("the database student").' ">' ; yields
<a href="https://www.google.com/?q=the+database+student " >
Example: Writing trusted user text to a content page with limited HTML markup and pagebreaks preserved
<?php echo strip_tags(nl2br($sel_page['content']),"<b><br><li><ol><ul><a><i><strong><emp>" ); ?>
 

Friday, October 14, 2011

Connecting Oracle SQL Developer to MySQL

Scenario

You have an Oracle Database and a MySQL database running on your Windows 7 machine that you are using for training/development purposes. You use Oracle SQL Developer to run code on the local Oracle database. Now you want to use Oracle SQL Developer to run code on your local MySQL Database.

Solution Summary

You need to unzip the JDBC (Java DataBase Connecttion) Driver for MySQL to somewhere on your harddrive, and link to it in Oracle SQL Developer. You will then see a MySQL tab in the New/Select Database Connection dialog which will allow you to connect to your SQL databases.

Procedure

  1. Download the JDBC Driver from the MySQL website. I found it at dev.mysql.com/downloads/connector/j/
    • Note: You should have a MySQL account to down load this. The proper file will have a name like mysql-connector-java-5.1.18.zip (the .tar.gz version, also known as a "tar ball" is for Unix/Linux operating systems)
  2. To install it all you need to do is unzip the file and put the whole folder in an appropriate place. (The instructions included with the driver say that say you need to set a CLASSPATH environment variable. I did not set this and it worked for me.) Here are some places to put it:
    • In your \sqldeveloper\jdbc\ folder
    • In your <ORACLE_HOME>\jdbc\ folder
  3. Open Oracle SQL Developer.
  4. Click Tools|Preferences|Database|Third Party JDBC Drivers
  5. Click Add Entry
  6. Navigate to and open the directory where you put the unzipped JDBC Driver then Select   the .jar file with the same name as the directory. (mysql-connector-java-5.1.18.jar)
  7. Click OK.
  8. Make sure your MySQL database is running.
  9. Use the Connections Tab make a new connection.
Result: You should see a MySQL tab in the New/Select Database window.

Test it out

  1. Create a connection name: root_mysql
  2. Username: root
  3. Password: <If you have secured your database with a password type it here>
  4. Hostname: probably localhost (or 127.0.0.1 or your computer's name)
  5. Port: probably the default for MySQL 3306.
  6. Choose Database: If you have put the proper information in above, this will show you a dropdown list of the databases in your MySQL configuration. Choose mysql.
  7. Click Test.

Result: Hopefully you will see a Status: Success message, and a new connection will appear in your connections pane.