Article published by : raju on Friday, August 11, 2017 - Viewed 40 times

Category : Software

Introduction of Java JDBC

What is API Programming interface (Application programming interface) is a report that contains portrayal of the considerable number of elements of an item or programming. It speaks to classes and interfaces that product projects can take after to speak with each other. An API can be made for applications, libraries, working frameworks, and so forth .. Propelled JAVA Training in Marathahalli bangalore JDBC Driver JDBC Driver is a product segment that empowers java application to connect with the database.There are 4 sorts of JDBC drivers:
1. JDBC-ODBC connect driver
2. Native-API driver (mostly java driver)
3. Network Protocol driver (completely java driver)
4. Thin driver (completely java driver)
1) The ODBC driver should be introduced on the customer machine.
2) Native-API driver The Native API driver utilizes the customer side libraries of the database.
The driver changes over JDBC technique calls into local calls of the database API. It is not composed totally in java. Favorable position: • performance updated than JDBC-ODBC connect driver. Burden: • The Native driver should be introduced on the every customer machine. • The Vendor customer library should be introduced on customer machine. 3) Network Protocol driver The Network Protocol driver utilizes middleware (application server) that proselytes JDBC calls straightforwardly or in a roundabout way into the merchant particular database convention. It is completely composed in java. Preferred standpoint: • No customer side library is required in light of utilization server that can perform many errands like examining, stack adjusting, logging and so on. Detriments: • Network bolster is required on customer machine. • Requires database-particular coding to be done in the center level. • Maintenance of Network Protocol driver turns out to be exorbitant in light of the fact that it requires database-particular coding to be done in the center level. 4) Thin driver The thin driver changes over JDBC calls specifically into the merchant particular database convention. That is the reason it is known as thin driver. It is completely composed in Java dialect. Favorable position: • Better execution than every single other driver. • No programming is required at customer side or server side. Disservice: • Drivers relies upon the Database. 5 Steps to interface with the database in java There are 5 stages to interface any java application with the database in java utilizing JDBC. They are as per the following:
• Register the driver class
• Creating association
• Creating explanation
• Executing questions
• Closing association
1) Register the driver class The forName() technique for class is utilized to enlist the driver class. This strategy is utilized to powerfully stack the driver class. Punctuation of forName() strategy open static void forName(String className)throws ClassNotFoundException
2) Create the association protest The getConnection() strategy for DriverManager class is utilized to build up association with the database.
1) open static Connection getConnection(String url)throws SQLException
2) open static Connection getConnection(String url,String name,String secret word) tosses SQLException
3) Create the Statement protest The createStatement() strategy for Connection interface is utilized to make articulation. The question of proclamation is capable to execute inquiries with the database. open Statement createStatement()throws SQLException
4) Execute the inquiry The executeQuery() strategy for Statement interface is utilized to execute inquiries to the database. This technique restores the question of ResultSet that can be utilized to get every one of the records of a table. open ResultSet executeQuery(String sql)throws SQLException
5) Close the association protest By shutting association protest articulation and ResultSet will be shut naturally. The nearby() strategy for Connection interface is utilized to close the association. Linguistic structure of close() strategy open void close()throws SQLException Case to interface with the Oracle database in java For interfacing java application with the prophet database, you have to take after 5 stages to perform database network. In this case we are utilizing Oracle10g as the database. So we have to know following data for the prophet database:
1. Driver class: The driver class for the prophet database is oracle.jdbc.driver.OracleDriver.
2. Connection URL: The association URL for the oracle10G database is jdbc:oracle:thin:@localhost:1521:xe where jdbc is the API, prophet is the database, thin is the driver, localhost is the server name on which prophet is running, we may likewise utilize IP address, 1521 is the port number and XE is the Oracle benefit name. You may get all these data from the tnsnames.ora record.
3. Username: The default username for the prophet database is framework.
4. Password: Password is given by the client at the season of introducing the prophet database. Two approaches to stack the container record: 1.paste the ojdbc14.jar document in jre/lib/ext envelope
2.set classpath
1) glue the ojdbc14.jar record in JRE/lib/ext organizer: Initially, look through the ojdbc14.jar document at that point go to JRE/lib/ext envelope and glue the container record here.
2) set classpath: There are two approaches to set the classpath:
• temporary
• permanent


Keywords: Advanced JAVA Training in Marathahalli bangalore, Advanced JAVA Training Center in Marathahalli bangalore, Advanced JAVA Training Courses in Marathahalli bangalore

By: raju

Article Directory:

Copy and Paste Link Code:

Read other Articles from raju: More »

Article ID 1048672 (Views 40)

Sponsor Listing Canadian Pharmacy