How the driver be loaded ?

We all know using the sentences like
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
connection = DriverManager.getConnection(hostName,userName,password);
what had happended behind these two sentences ?
from the output
"DriverManager.initialize: jdbc.drivers = null
JDBC DriverManager initialized
registerDriver: driver
[className=sun.jdbc.odbc.JdbcOdbcDriver,sun.jdbc.odbc.JdbcOdbcDriver@b753f8]
The first sentence has invoked the method "DriverManager.registerDriver()"
How can the sentence do this?

Once the class is loaded the JDBC API makes a one or
more calls into a specific interface. That interface,
implemented as a class, registers itself with the JDBC
API.i am unsure what you mean about the JDBC API making calls into an
interface.
i think what may be confusing the original poster is that code in the
class appears to be executing when Class.forName is used to load the
class. the answer of course being that in fact that is what is happening
code is executing when the class is loaded and this has nothing to do
with JDBC per se other than what is suggested in the API that it should
do.
so for the example given the code looks something like this.
public class JdbcOdbcDriver implements Driver{
  static{
    DriverManager.registerDriver(new JdbcOdbcDriver());
     Constructors and methods go here....
}anyway i also made up a little test program to show when a static
initializer block is run.
public class Test{
  public static void main(String args[])throws Exception{
    System.out.println("Hello from Test.");
    Class c = Class.forName("StaticInit");
    System.out.println("Class is loaded.");
    Object o = c.newInstance();
    StaticInit si = (StaticInit) o;
    si.sayHello();     
class StaticInit{
  static{
    System.out.println("Hello from static initializer.");
  public void sayHello(){
    System.out.println("Hello from object method.");     

Similar Messages

  • DVD & Blu Ray Burner Drive Trays Do Not Stay Open When Media is in the Drive

    I have a problem with both Windows 8/8.1 and the Windows 10 Technical Preview (there is no issue when I run Windows 7).
    I have 2 optical drives: 1) DVD Burner and 2) Blu Ray Burner (I just got the second drive a few weeks ago). They are attached to the secondary SATA Chip (see below for specifics).
    The problem I'm having is that when I eject media from either drive, the drive does not stay open, but rather immediately closes. Before I got the Blu Ray Burner, I had this problem with just the single DVD Burner by itself. I was hoping when I installed
    Windows 10 Technical Preview that this problem would not be present, but it is present in that O/S as well.
    This problem will repeat continuously if I attempt to use the eject button and so I either have to grab the disc while the tray is moving, or if I press the eject button again on the drive at the right time, I can get it to re-open and not close (this
    is tricky to get the button timing right as it seems like it has to be done close to when the drive tray is fully extended when it starts retracting). It usually takes me 5 to 10 button presses to get it to stay open. Sometimes it will stay open for about
    0.5 to 1s before it closes again, but most of the times it just immediately closes. I also have the same problem if I use the software eject feature by right clicking on the drive and choosing eject.
    Of course, the expected behavior is that pressing the eject button should open the tray, but not close it immediately allowing you to remove the disc.
    Here is some background information about my system and how the drives are connected:
    1. Motherboard: Gigabyte GA-EP45-ED3P Revision 1.0 LGA 775
    2. Interface (for both drives): Gigabyte SATA II Chip - 2 x SATA 3 GB/s connectors (GSATA2_0, GSATA2_1) supporting up to 2 SATA 3 GB/s devices
    3. Memory: 8 GB (4 x 2 GB)
    It should be noted that I tri-boot between Windows 7, 8/8.1, and 10 Technical Preview and that this issue is not present in Windows 7, but has always been there in Windows 8/8.1 and now it is present in 10TP as well.
    I've had this system for just over 6 years now and it is still going strong. It should be noted that I have both drives on the secondary SATA chip (as identified above), which is meant to be used with removable SATA devices.
    Since the problem exhibits itself in both Windows 8/8.1 and 10TP, a reinstall of the O/S will have no affect on this problem and so this appears to be some other issue that is consistent between Windows 8/8.1 and 10TP.
    I'd appreciate your support in looking at this issue - thanks!
    Matt Caspermeyer
    P.S. I also submitted this feedback through the Insider Program.
    Matt

    Hey Zagayer,
    Thanks for using Apple Support Communities.
    As you now have two optical drives in your Mac Pro, you need to be able to choose which drive to eject.  That is built into the system.  You just hold the Option key while tapping eject for the 2nd drive.
    OS X Mountain Lion: Eject a disk
    http://support.apple.com/kb/PH10613
    If your computer has two optical drives, hold down Option-Media Eject or Option-F12 to eject a disc from the second drive.
    Have a nice day,
    Mario

  • Need to format the drive on a 2006 MacBook Pro 10.6.8. Command R does not get it to recovery mode. I need to format, reload OS10 and partition the drive.

    I tried command R to get into recovery mode. My goal is to format the MBP drive, partition the drive and load Windows through Boot Camp. Disk Utility will not allow access to reformat the drive. Is there another access method to format the drive?

    jjoside,
    Snow Leopard (Mac OS X 10.6.8) does not come with Recovery mode; you’d need Lion (Mac OS X 10.7) or newer for that. If you’d like to reformat your internal disk and reïnstall Snow Leopard on it, you’ll need to boot from the white retail Snow Leopard DVD which was originally used to install Snow Leopard on your MacBook Pro. [Your 2006 MacBook Pro came from the factory with Tiger (Mac OS X 10.4.something) installed.] If you no longer have your white Snow Leopard DVD, you can purchase a replacement Snow Leopard DVD from Apple.

  • How the categoryId is mapped?

    Hi All,
    If selecting one program i'm passing categoryId=001 as a query string. according to this categoryId only order is placing, how the all configurations and mapping will done in background. please any one can help on this in detail?? It means how the catalog will loaded all sku's??
    Thanks.

    It means how the catalog will loaded all sku's??In case of standard catalog we will use same catalog for all users.
    I think it will happen only for custom catalog as we have property "catalog" in user item-descriptor "dcs_user" table in userProfile.xml. It is as below:
    <property category-resource="categoryCommerceGeneral" name="catalog" item-type="catalog" display-name-resource="catalog" column-name="user_catalog"
              repository="/atg/commerce/catalog/ProductCatalog">
            <attribute name="resourceBundle" value="atg.commerce.UserProfileTemplateResources"/>
          </property>We can assign catalog to user(s);
    -RMishra
    Edited by: RMishra on Dec 13, 2012 7:14 PM
    Edited by: RMishra on Dec 13, 2012 7:16 PM

  • I have an issue with Acrobat, after a few uses, the program will not load, the only way to fix it is to completely uninstall the CS suite wipe the drive and reinstall the software, then after a few uses it stops working, how do i fix this?

    after a few uses, the program will not load, the only way to fix it is to completely uninstall the CS suite wipe the drive and reinstall the software, then after a few uses it stops working, how do i fix this?

    Not sure of an answer to your basic question, but it may be that you can run a repair (on Windows --> Control Panel>Programs & Features and run the repair on Acrobat). If that fixes the issue, at least temporarily, at least you will not be reinstalling everything -- a real pain.
    Next, open Acrobat and go to the Help to run the updates and be sure you are current. On some OSs, the updates are critical.

  • I recently bought an Epson Artisan 837 printer. I installed the driver and now Photoshop from CS3 will not open. It quits when the Twain portion of the program starts loading. Does anyone know how to fix this so my printer will work with Photoshop??

    I recently bought an Epson Artisan 837 printer. I installed the driver and now Photoshop from CS3 will not open. It closes every time it gets to the point where it is loading the Twain portion. Does anyone know how to fix this so my printer and Photoshop will work together? Thanks for any help I can get!

    You're welcome. 
    But, no, don't look to  Epson for fixes to their  driver in newer versions, and Adobe has deprecated the TWAIN plug-in.  Hoping for a solution there is futile.  That has not happened and it's never going to happen.  The consensus is that it's pretty foolish to tie up Photoshop to scan.  Honestly.
    Any improvement in the behavior of newer versions of the Epson drivers in that regard would be pure coincidence.
    You need to understand that you never, ever scan "within" Photoshop, as Photoshop has no scanning capabilities whatsoever.  When you use the Import > Twain plug-in all you are doing is blocking Photoshop while you call up the stand-alone Epson scanning software.  If you think about it, its most inefficient.
    VueScan has a pretty powerful scanning plug-in that can be called from the Impost menu—if you insist.  VueScan is not free, but it's a pretty good value, IMO.
    As for the Epson CD printing software, I have no clue.  Sorry. 

  • My Mac keeps starting up to the disk utilities screen. Im guessing i need to repair the disk or load my backed up memory but i am unsure of how to do that. I have all my memory backed up on an external hard drive.

    My Mac keeps starting up to the disk utilities screen. Im guessing i need to repair the disk or load my backed up memory but i am unsure of how to do that. I have all my memory backed up on an external hard drive.

    The Disk Utility screen has instructions right on it.
    Just read them and follow the directions.
    Readers can help if you get stuck.
    It opens with something like, "select a disk, volume, or image".
    You click on your drive in the left column, top item.
    The next screen spells out how to do a ( Repair Disk ).
    You have a Macintosh. It will not cut your hand off.
    If something dangerous is coming, it will say stuff like, "this will erase all the data on your drive. Do you want to proceed?"

  • What do i do when external optical drive doesn't show up in finder?  how can i import software, music, etc. when the drive isn't recognized/mounted/whatever?

    the internal optical drive on my early 2006 20"imac has mechanical problems ejecting discs.  i've gone thru all the recommended steps to eject discs, and have luckily been able to eject the last 3 discs but only after spending 30-60 minutes going thru all of the steps over and over, and today just trying "eject disc" in itunes since i had itunes open.  i don't want to put another disc in - the drive clearly has problems with the mechanical eject mechanism, and from what i've read that's not unique to my computer.
    i bought an external optical drive: lite on, clamshell design to avoid problems with the eject mechanism; i contacted the mfr who said it's mac compatible.
    the drive plays dvds, which is all i've tried so far, but doesn't show up in finder.  so i don't know how to use it to load software, or music, or anything besides watch dvds.
    is there something i can do to get the drive recognized/mounted/whatever?  i would prefer to not spend the $220 which was quoted to me by an authorized mac repair company, even tho i think that's probably a reasonable cost given the delicacy of the operation as shown on ifixit.com. 
    thanks!

    I have an external LaCie burner and it will not show up on my Mac unless I insert a CD or DVD - in that case, the media will show up (I have these settings in the Pref Pane):
    If you want to burn files or music to blank media, you can use Finder or Disk Utility for files, but should use an iTunes playlist/iTunes for music and a movie burn app for videos/movies (such as iDVD, Roxio Toast, Burn, etc).
    If you simply want to drag files over as a backup, an external hard drive is a much better solution than a burner.

  • How to find out which type of the driver is used in our application?

    Hi all,
    can anyone tell me how to find out which type of the driver is used in our application?
    Thanks in advance,
    Phoeniox

    Hi,
    Check out this...
    Class.forName("com.mysql.jdbc.Driver"); //if u r using MySql
    List drivers = Collections.list(DriverManager.getDrivers());
                   for(int i=0;i<drivers.size();i++)
                        Driver driver = (Driver)drivers.get(i);
                        String driverName = driver.getClass().getName();
                        System.out.println("Driver "+i+":::"+driverName);
    you need to load the driver and display in the same program.
    Then only you'l get the required result.
    prakhyath

  • How do u down load music from your flash drive to your older ipod nano 2gb

    how do u down load music from a flash drive to an older apple ipod nano 2gb

    You import it into iTunes and then sync the iPod.
    (78749)

  • HT1339 my older iPod my husband wants to use and his netbook does not have cd drive. How do I down load iPod and iTunes info for this product so he can now use it?

    my older iPod my husband wants to use and his netbook does not have cd drive. How do I down load iPod and iTunes info for this product so he can now use it?

    Your question(s) is/are a little hard to understand.  So your husband has an iPod as well as a netbook and he wants to be able to sync iPod with this netbook is that correct?  If so, he'll need to first download and install iTunes assuming the netbook is running some version of Windows such as 7, Vista, or XP.
    http://www.apple.com/itunes/download/
    As for importing or ripping music, he'll have to either use an external CD/DVD drive that is attached via USB or rip the songs to another PC you have with a built in CD/DVD drive.  Once you have imported them to the other computer, you can transfer the songs to an external hard drive or to his iTunes library via Home Sharing.
    If this isn't quite what you were looking for, please clarify.
    B-rock

  • CD stuck in the drive, how to remove it?

    I have a CD stuck in the drive, most likely by the up-lifting of the label. How can I eject this CD?

    You failed to mention what kind of Mac you have...  there are two different kinds of DVD drives.
    with a Mac Pro, the dvd drive has a tray, so you just manually open the drive door (a damp fingertip helps) and firmly push a straightened paper clip into the small hole below the tray on the right side. This forces the opening gears to turn, unseating the tray. Hook the edge of the tray and gently slide it out.
    The laptop "slot loading" drives are more difficult.

  • I have an imac 2009 the disk drive is damaged and I have lost the passwords I need to reset passwords I tried booting with a macosx disk from an external hard drive but did not read the drive how else can I reset password ?

    I have an imac 2009 the disk drive is damaged and I have lost the passwords I need to reset passwords I tried booting with a macosx disk from an external hard drive but did not read the drive how else can I reset password ?
    I have a 2012 mac book pro can I use that to connect with firewire and load osx that way? and how woudl I do that?
    Thanks so much!

    To what password are you referring? Do you mean your user account's admin password? Or do you mean the master password for File Vault or do you mean a Firmware Password?
    For an admin password:
    Forgot Your Account Password
    For Snow Leopard and earlier
         Mac OS X 10.6- If you forget your administrator password
    For Lion/Mountain Lion
        Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
         When the menubar appears select Terminal from the Utilities menu.
         Enter resetpassword at the prompt and press RETURN. Follow
         instructions in the dialog window that will appear.
         Or see Reset a Mac OS X 10.7 Lion Password and
         OS X Lion- Apple ID can be used to reset your user account password.
    If you cannot do the above then try this:
      1. Boot to Safe Mode by restarting and after the chime press and hold down the COMMAND-S keys until a black screen with white type appears.
      2. At the prompt, type the following commands pressing return after each command line:
         /sbin/fsck -yf
         If you do not receive a "Filesystem OK" message then repeat this command until
         you do.  If after seven tries you still do not receive a "Filesystem OK" message,
         then the system is corrupted and needs to be reinstalled.
         mount -uw /
         cd /private/var/db/netinfo
         mv local.nidb local.old
         rm ../.AppleSetupDone
         shutdown -r now
    The second-to-last command above will cause OS X to think that the operating system is newly installed, and when the new owner starts up the computer it will send him/her to the startup wizard where he/she can start a new user without reinstalling.
    This last method does not actually change a password. It simply removes the user accounts and lets you create an initial admin account as if the computer were new out of the box.
    How to reset the OS X password without a startup CD:
    Reboot into Single-user Mode. Enter the following and press RETURN after each command line
       1. Type fsck -fy
       2. Type mount -uw /
       3. Type passwd <username>
    I have never tried this method myself.

  • How to make udev load ALSA driver automaticly?

    I have added " modprobe snd-via82xx " (ALSA driver) to /etc/profile.d/mysh.sh, and I could use almost every multimedia software except mp3blaster.
    But after I installed udev, the udev load "via82cxxx_audio"  (OSS driver) automaticly instead of snd-via82xxx. mp3blaster can work now, but the esd output plug-in of XMMS could not work, so did stardict (is here anyone have ever used it?).
    I modprobe snd-via82xxx manually, but have no use.
    How to make OSS and ALSA work parallelly? And, how to make udev load ALSA automacticly instead of OSS?

    I have knew this method. What I mean is that the udev load OSS driver at boot. Although I modprobe the ALSA driver,  my software (stardict) can not play a wav sound (Other software can).
    I wants udev NOT to load OSS driver at boot. Or, it is the best, make OSS and ALSA work parallelly,

  • I Just purchased a used MacBook Air but it has no OS, how can I re-load the OS?

    I Just purchased a used MacBook Air but it has no OS, how can I re-load the OS?

    It depends on which operating system was on it when it was released.  Older MBAs need disks or a special thumb drive to boot for OS recovery.
    Let’s assume it is new enough that it has a recovery partition built in.  You can try this and see if it works and if it doesn’t work then it is old enough to need he aforementioned recovery media.
    It is simple.  First you format the system disk and then you install OS X.
    You will need to be in an area with a good wireless Internet signal.
    Boot in Recovery Mode:
    Power it on and when you hear the bong hold down the Command and R keys simultaneously.
    Format the system disk:
    > Disk Utility
    > Select your system drive.
    > Partition
    > Partition Layout: 1 Partiton
    > Options...
    > GUID Partition Table
    > OK
    > Name: Macintosh HD
    > Format: Mac OS Extended (journaled)
    > Apply
    > Disk Utility > Quit Disk Utility
    Install OS X:
    > Click on Install OS X and follow the instructions.

Maybe you are looking for