Blogger templates

Social Share

Pages

Powered by Blogger.

Blogger news

How can I connect Oracle database in Java?

We can connect Oracle database in Java. We can write following code:
import java.sql.*;
1.       Class DbConnection{
2.                       public static void main(String args[]){
3.                              Class.forName(“oracle.jdbc.driver.OracleDriver”);
4.                              Connection conn=DriverManager.getConnection(“jdbc:oracle:thin:@localhost:1521:xe”,”system”,”java”);
5.                                System.out.println(“Database connects successfully……………”);
6.                                conn.close();
7.                       }
8.       }
Note: system is user name of Dbbase and java is password.
We can execute this code on editor and IDE.
On Notepad:
Save: DbConnection.java
Open CMD prompt:


Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment