cancel
Showing results for 
Search instead for 
Did you mean: 

Code to access db2e databse from java ?

Former Member
0 Kudos

i am woking on MAM application of SAP MI

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hai,

how do you want to access the database.

u want code for JDBC.

Different 4 types of drivers r there.

give more info.

for MYSQL

Class.forName("org.gjt.mm.mysql.Driver").newInstance();

}

catch (Exception exc) {

System.err.println("Exception in init(): Unable to load JDBC driver");

exc.printStackTrace();

}

try {

conn = DriverManager.getConnection("jdbc:mysql://localhost/" + DBNAME);

FOR ORACLE

// Connection conn = new oracle.jdbc.driver.OracleDriver().

// defaultConnection ();

Connection conn = DriverManager.getConnection(connStr,

"scott", "tiger");

Statement stmt = conn.createStatement ();

ResultSet rset = stmt.executeQuery ("SELECT DIVISION, COMPLAINT, " +

" CPU_CODE ,COMP_DT FROM scott.Bug ");

come back for more info.good luck