Category Archives: Uncategorized

JDBC Driver Types

JDBC Driver Types

JDBC drivers are divided into four types or levels. The different types of jdbc drivers are:

Type 1: JDBC-ODBC Bridge driver (Bridge)
Type 2: Native-API/partly Java driver (Native)
Type 3: AllJava/Net-protocol driver (Middleware)
Type 4: All Java/Native-protocol driver (Pure)

4 types of jdbc drivers are elaborated in detail as shown below:

Type 1 JDBC Driver

JDBC-ODBC Bridge driver

The Type 1 driver translates all JDBC calls into ODBC calls and sends them to the ODBC driver. ODBC is a generic API. The JDBC-ODBC Bridge driver is recommended only for experimental use or when no other alternative is available.

 

Type 1: JDBC-ODBC Bridge

Advantage

The JDBC-ODBC Bridge allows access to almost any database, since the database’s ODBC drivers are already available.

Disadvantages

1. Since the Bridge driver is not written fully in Java, Type 1 drivers are not portable.
2. A performance issue is seen as a JDBC call goes through the bridge to the ODBC driver, then to the database, and this applies even in the reverse process. They are the slowest of all driver types.
3. The client system requires the ODBC Installation to use the driver.
4. Not good for the Web.

Type 2 JDBC Driver

Native-API/partly Java driver

The distinctive characteristic of type 2 jdbc drivers are that Type 2 drivers convert JDBC calls into database-specific calls i.e. this driver is specific to a particular database. Some distinctive characteristic of type 2 jdbc drivers are shown below. Example: Oracle will have oracle native api.

 

Type 2: Native api/ Partly Java Driver

Advantage

The distinctive characteristic of type 2 jdbc drivers are that they are typically offer better performance than the JDBC-ODBC Bridge as the layers of communication (tiers) are less than that of Type
1 and also it uses Native api which is Database specific.

 

Disadvantage

1. Native API must be installed in the Client System and hence type 2 drivers cannot be used for the Internet. 
2. Like Type 1 drivers, it’s not written in Java Language which forms a portability issue. 
3. If we change the Database we have to change the native api as it is specific to a database
4. Mostly obsolete now
5. Usually not thread safe.

Type 3 JDBC Driver

All Java/Net-protocol driver

Type 3 database requests are passed through the network to the middle-tier server. The middle-tier then translates the request to the database. If the middle-tier server can in turn use Type1, Type 2 or Type 4 drivers.

 

Type 3: All Java/ Net-Protocol Driver

Advantage

1. This driver is server-based, so there is no need for any vendor database library to be present on client machines.
2. This driver is fully written in Java and hence Portable. It is suitable for the web.
3. There are many opportunities to optimize portability, performance, and scalability. 
4. The net protocol can be designed to make the client JDBC driver very small and fast to load. 
5. The type 3 driver typically provides support for features such as caching (connections, query results, and so on), load balancing, and advanced 
system administration such as logging and auditing.
6. This driver is very flexible allows access to multiple databases using one driver.
7. They are the most efficient amongst all driver types.

Disadvantage

It requires another server application to install and maintain. Traversing the recordset may take longer, since the data comes through the backend server.

Type 4 JDBC Driver

Native-protocol/all-Java driver

The Type 4 uses java networking libraries to communicate directly with the database server.

Type 4: Native-protocol/all-Java driver

Advantage

1. The major benefit of using a type 4 jdbc drivers are that they are completely written in Java to achieve platform independence and eliminate deployment administration issues. It is most suitable for the web. 
2. Number of translation layers is very less i.e. type 4 JDBC drivers don’t have to translate database requests to ODBC or a native connectivity interface or to pass the request on to another server, performance is typically quite good. 
3. You don’t need to install special software on the client or server. Further, these drivers can be downloaded dynamically.

Disadvantage

With type 4 drivers, the user needs a different driver for each database.

 

Advertisements

Android Video Streaming (Video View)

Video 

1.Test.java

package com.sample.test;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.VideoView;

public class Test extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);

/*Intent move=new Intent(Intent.ACTION_VIEW);
move.setDataAndType(Uri.parse(“android.resource://”+getPackageName()+”/”+R.raw.video), “video/*”);
startActivity(move);*/

VideoView videoView =(VideoView)findViewById(R.id.videoView);
MediaController mediaController= new MediaController(this);
mediaController.setAnchorView(videoView);
Uri uri=Uri.parse(“android.resource://”+getPackageName()+”/”+R.raw.video);
videoView.setMediaController(mediaController);
videoView.setVideoURI(uri);
videoView.requestFocus();

videoView.start();
}

}

 

2.activity_test.xml

<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android&#8221;
xmlns:tools=”http://schemas.android.com/tools&#8221;
android:layout_width=”match_parent”
android:layout_height=”match_parent”
android:orientation=”vertical” >

<TextView
android:id=”@+id/textView1″
android:layout_width=”wrap_content”
android:layout_height=”wrap_content”
android:text=”@string/hello_world” />

<VideoView
android:id=”@+id/videoView”
android:layout_width=”match_parent”
android:layout_height=”match_parent” />

</LinearLayout>

 

3.AndroidManifest.xml

<?xml version=”1.0″ encoding=”utf-8″?>
<manifest xmlns:android=”http://schemas.android.com/apk/res/android&#8221;
package=”com.sample.test”
android:versionCode=”1″
android:versionName=”1.0″ >

<uses-sdk
android:minSdkVersion=”8″
android:targetSdkVersion=”17″ />

<application
android:allowBackup=”true”
android:icon=”@drawable/ic_launcher”
android:label=”@string/app_name”
android:theme=”@style/AppTheme” >
<activity
android:name=”com.sample.test.Test”
android:label=”@string/app_name” >
<intent-filter>
<action android:name=”android.intent.action.MAIN” />

<category android:name=”android.intent.category.LAUNCHER” />
</intent-filter>
</activity>
</application>

</manifest>

Multi Colors for Single Text view in Android

String your1stString=”Welcome”;
String your2ndString=”RAJA”;
String data=”<font COLOR=\”RED\”><b>” + your1stString + “</b></font> TO <font COLOR=#ff0000><b>” + your2ndString + “</b></font>”;

textviewobj.setText(Html.fromHtml(data));

Secure your website with JavaScript, NO RIGHT CLICK for Images

Secure your website with JavaScript, NO RIGHT CLICK for Images

Secure your website with JavaScript, NO RIGHT CLICK for Images
Have you ever worked really hard on graphics for your site only to find later that someone has stolen them as their own. You can help encrypt and protect your site with the following HTML codes. No right click block is 100% effective, but they will help against novices.

Use the script below so when someone right clicks to save an image off your page, a message will come up letting people know that your information is copyrighted.

This script may not work in all browsers, and is not foolproof. If someone really wants something from your page they can find ways around it, but at least it’s a warning to people who want to take your graphics. But it certainly is a great start.

Copy and paste the following code, and make sure it comes right after your tag:
var message=”Function Disabled!”; function clickIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function(“alert(message);return false”)

If you don’t like using javascript, you can always use a span tag to position a transparent gif over the top of the image like the example code below. Don’t forget, you will need to create a transparent.gif to implement this method.
Protected Image.

“NO RIGHT CLICK” for Source

Here is a handy little script which will not only protect your images from right clicking, but your whole page. Remember this only stops some visitors from viewing your source. There are ways around it and if someone really wants to view your source they may find a way. There is another trick below to protect your source code, so keep reading.

var message=”Function Disabled!”; function clickIE4(){ if (event.button==2){ alert(message); return false; } } function clickNS4(e){ if (document.layers||document.getElementById&&!document.all){ if (e.which==2||e.which==3){ alert(message); return false; } } } if (document.layers){ document.captureEvents(Event.MOUSEDOWN); document.onmousedown=clickNS4; } else if (document.all&&!document.getElementById){ document.onmousedown=clickIE4; } document.oncontextmenu=new Function(“alert(message);return false”)

Disable Copy and Paste for greater website security.
One of the most popular questions I recieve here at Hypergurl is “How do you stop visitors from stealing your webpage information?”
Below is a little trick that will stop your visitors from copying and pasting your webpage information. Anyone with experience may know a way around this trick. However it will make it hard enough to discourage them and get them moving on to easier targets.
Add the following html code to your BODY tag:
Here is how your BODY tag may look once implimented:

ondragstart=”return false” onselectstart=”return false”

FB Friend Chat Box Easily – Get Any Picture Code

1. First You Need To Login In Your Facebook Account .

2. Now You Just Open This WebsiteClick Here .

3. Now You Choose Any file From Your PC .

4. In Next Step Click on Upload Button .

5. After Few Seconds you will get picture code  When You will click on Show Codes .then just copy it

6. And Now Paste This Code in Your Fb Friend Chat Box .

That’s It Now You Are Done 🙂

Let’s Enjoy This Cool Trick Of Facebook

How to login to your WordPress Site

Many bloggers are not aware of how to login to their blog without having a link on their home page, so here is a quick guide on how to get logged into your site.

Step 1: Start off by typing in your blog’s domain/url into your browser, and add /wp-admin at the end:

 

Step 2: After you have typed in your site’s url + /wp-admin you should see a  log-in screen like this:


Step 3: once you are at your log-in screen, enter your assigned username/password into the provided fields:


 

Step 4: After you have entered in your log-in credentials, press log in, and you will be brought to your WordPressdashboard:

%d bloggers like this: