Close
Login to Your Account
Faadooengineers

Results 1 to 2 of 2

Thread: Help for java and Oracle connection

  1. #1

    Help for java and Oracle connection

    Hi, We r having subject of database engg. this sem. We have to perform practicals for the same. Few days back, when I tried executing java program having oracle queries it started showing "java.sql.SQLException: Specified driver could not be loaded due to system error 1114(Oracle XE)". I have it using the DSN but even then it is generating error.... Can someone plz help me out coz this Exception is causing severe problem...... Waiting for a reply.......





  2. #2

    Re: Help for java and Oracle connection

    wat driver r u using??
    try out the following code:


    import java.sql.*;

    class Dba{
    public static void main(String args[])throws Exception{



    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

    Connection con = DriverManager.getConnection("jdbc:odbc:Oracle", "scott", "tiger");
    System.out.println("connection was ok");
    Statement stmt = con.createStatement();
    ResultSet rs =stmt.executeQuery("SELECT * FROM EMP;");
    ResultSetMetaData rsmd = rs.getMetaData();
    int j= rsmd.getColumnCount();
    while(rs.next()){
    for(int i=1;i<j;i++){
    String s1 = rs.getString(i);
    System.out.print(s1+ '\t');
    }
    System.out.println();
    }
    System.out.println(rs);

    }
    }// the program uses jdbc odbc drivers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Share anywhere and get download.

50%