JDBC Connection with DB2

swasti
@swasti-to1BPZ โ€ข Oct 25, 2024

Hi
i am a CSE student. i have completed core java, i am not able to graps a vast knowledge on JDBC connection.
so kindly give some notes, tips & tricks on JDBC which help me to developing some large project.

thank you.

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Elisa

    @elisa-4hps94 • Oct 28, 2007

    swastiHi
    i am a CSE student. i have completed core java, i am not able to graps a vast knowledge on JDBC connection.
    so kindly give some notes, tips & tricks on JDBC which help me to developing some large project.

    thank you.

    Following might help

     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    return DriverManager.getConnection("jdbc:odbc:" + databaseName, userId, password);
  • dhwanitsshah

    @dhwanitsshah-xHxdpr • Oct 30, 2007

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc:odbc:DSNname");
    Statement st = con.createStatement();
    
    e.g.->String sql="Select * from databasename";
    St.executeUpdate(sql);
  • zeem_710

    @zeem-710-ulO3qD • Nov 5, 2007

    ๐Ÿ˜Ž Here is the code to connect JAVA and DB2

    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con=DriverManager.getConnection("jdbc.odbc.DSN");
    
    If your has a username and password, then provide the following:
    
    DriverManager.getConnection("jdbc:odbc:DSN","user","password");
    
    

    Add the path of IBM>db2>SQLLIB>BIN to the "path" environment variable(if u r working with Windows).
    or, extract the "com" package from the src.zip file in bin folder of IBM DB2 to the folder where u have stored ur Java class file.

  • mlumanta

    @mlumanta-ajhB42 • Dec 3, 2007

    hi guys im new here., how are you?