connection to db2 database
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   kamali_ganesan
Posted On:   Friday, September 7, 2001 05:02 AM

I have created a datastore and in my java program am looking up for the datasource and creating a connection from that . the datasource instance is created but the getConnection method is failing.My java program is import java.util.Enumeration; import javax.naming.*; import javax.rmi.*; import java.rmi.*; import java.sql.*; import javax.sql.*; import java.util.*; import java.io.* ; import com.ibm.ejs.dbm.jdbcext.*; public class Sample { public String returnconnection() { try { Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.   More>>

I have created a datastore and in my java program am looking up for the datasource and creating a connection from that . the datasource instance is created but the getConnection method is failing.My java program is

import java.util.Enumeration;

import javax.naming.*;

import javax.rmi.*;

import java.rmi.*;

import java.sql.*;

import javax.sql.*;

import java.util.*;

import java.io.* ;


import com.ibm.ejs.dbm.jdbcext.*;

public class Sample {


public String returnconnection() {


try {

Hashtable env = new Hashtable();

env.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.ejs.ns.jndi.CNInitialContextFactory");


Context ctx = new InitialContext(env);


DataSource ds = (javax.sql.DataSource)ctx.lookup("jdbc/billingdsn");

Connection cn = ds.getConnection("db2admin","db2admin");


//Statement s=null;

//String qry = "select * from test";

//boolean i = s.execute(qry);



return("trueds"+ds.toString ());

}

catch (SQLException sqlex) {

return ("false "+sqlex);

}

catch (NamingException e) {

return ("falseds1"+e);

}

}

}


I am getting some java.lang.UnsupportedLinkError.
Can anyone help me in this .....


Thanks/

   <<Less

Re: connection to db2 database

Posted By:   Gandalf_Grey  
Posted On:   Tuesday, September 11, 2001 07:16 AM

UnsupportedLinkError means that a native library cannot be found.


The IBM DB2 JDBC driver uses native libraries which the JVM should be able to find. You have two possibilities:
  • 1. Edit your OS's library path and add the path to the IBM DB2 libraries to it.

  • 2. set java.library.path on JVM startup.



  • Hope this'll help. If you have further questions , ask..

    About | Sitemap | Contact