vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I am trying to connect to DB2 database from JAVA. This is following piece of code i am using to connect to DB2 database Class.forName("com.ibm.db2.jcc.DB2Driver"); Connection connection = DriverManager.getConnection( "jdbc:db2://devdb:6004/dev", "db2admin", "db2admin"); And i am using the JDBC drivers provided in the /SQLLIB/java/db2jcc.jar of the DB2 installation directorty, But i get the following exception: com.ibm.db2.jcc.c.SqlException: IO Exception opening socket to server papdevdb on port 6004. The DB2 Server may be down. at com.ibm.db2.jcc.a.a.<init>(a.java:110) at com.ibm.db2.jcc.a.b.a(b.java:1116) at com.ibm.db2.jcc.c.l.<init>(l.java:212) at com.ibm.db2.jcc.a.b.<init>(b.java:190) But I have verified that the DB server is up, by connecting directly to the server. __________________________________________________ ___________________________ I have also tried to connect using the another driver : Class.forName("COM.ibm.db2.jdbc.net.DB2Driver"); Connection connection = DriverManager.getConnection( "jdbc:db2://devdb:6004/dev", "db2admin", "db2admin"); And i am using the JDBC drivers provided in the /SQLLIB/java/db2java.zip of the DB2 installation directorty, But i get the following exception: COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0616E Error opening socket. SQLSTATE=08S01 at COM.ibm.db2.jdbc.net.SQLExceptionGenerator.socketE xception(SQLExceptionGenerator.java:646) at COM.ibm.db2.jdbc.net.DB2Connection.create(DB2Conne ction.java:330) at COM.ibm.db2.jdbc.net.DB2Connection.<init>(DB2Conne ction.java:256) at COM.ibm.db2.jdbc.net.DB2Driver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager .java:512) at java.sql.DriverManager.getConnection(DriverManager .java:171) at TestDB2Connection.main(TestDB2Connection.java:37) As i am new to DB2, any type of help would be great!!!, Thanks, Shivas |
| |||
| try with port 50000 //localhost:50000/DBNAME DB2 Get DBM Cfg TCP/IP Service name (SVCENAME) = db2c_DB2 On windows, see the file %SystemRoot%\system32\drivers\etc\services type %SystemRoot%\system32\drivers\etc\services | find /i "db2c_DB2" You should see something like this : db2c_DB2 50000/tcp PM "shivas" <shivasj@mindtree.com> a écrit dans le message de news:f2c2908d.0309072052.65fe38f6@posting.google.c om... > Hi, > I am trying to connect to DB2 database from JAVA. > This is following piece of code i am using to connect to DB2 database > > Class.forName("com.ibm.db2.jcc.DB2Driver"); > Connection connection = DriverManager.getConnection( > "jdbc:db2://devdb:6004/dev", > "db2admin", > "db2admin"); > > And i am using the JDBC drivers provided in the > /SQLLIB/java/db2jcc.jar of the DB2 installation directorty, > > But i get the following exception: > com.ibm.db2.jcc.c.SqlException: IO Exception opening socket to server > papdevdb on port 6004. The DB2 Server may be down. > at com.ibm.db2.jcc.a.a.<init>(a.java:110) > at com.ibm.db2.jcc.a.b.a(b.java:1116) > at com.ibm.db2.jcc.c.l.<init>(l.java:212) > at com.ibm.db2.jcc.a.b.<init>(b.java:190) > > But I have verified that the DB server is up, by connecting directly > to the server. > __________________________________________________ __________________________ _ > I have also tried to connect using the another driver : > Class.forName("COM.ibm.db2.jdbc.net.DB2Driver"); > Connection connection = DriverManager.getConnection( > "jdbc:db2://devdb:6004/dev", > "db2admin", > "db2admin"); > And i am using the JDBC drivers provided in the > /SQLLIB/java/db2java.zip of the DB2 installation directorty, > But i get the following exception: > COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0616E Error > opening socket. SQLSTATE=08S01 > at COM.ibm.db2.jdbc.net.SQLExceptionGenerator.socketE xception(SQLExceptionGener ator.java:646) > at COM.ibm.db2.jdbc.net.DB2Connection.create(DB2Conne ction.java:330) > at COM.ibm.db2.jdbc.net.DB2Connection.<init>(DB2Conne ction.java:256) > at COM.ibm.db2.jdbc.net.DB2Driver.connect(Unknown Source) > at java.sql.DriverManager.getConnection(DriverManager .java:512) > at java.sql.DriverManager.getConnection(DriverManager .java:171) > at TestDB2Connection.main(TestDB2Connection.java:37) > > > As i am new to DB2, any type of help would be great!!!, > > Thanks, > Shivas |
| ||||
| Originally posted by Shivas > Hi All, > > Using db2jstrt <portnumber> had set the jstrt running and this sovled > the probelm > > Thanks, > shivas Hi Shivas, Can you please explain what is db2jstrt .If possible can you send the code snippet for connection as i am facing the same problem. my code is String url="jdbc:db2://ind-spz7w2s1014:50000/TESTDB2"; String userName = "db2admin"; String password = "db2admin"; DriverManager.registerDriver((Driver)Class.fo- rName("COM.ibm.db2.jdbc.net.DB2Driver").newIn- stance()); con = DriverManager.getConnection(url,userName,password) ; //line 32 and my error is COM.ibm.db2.jdbc.DB2Exception: [IBM][JDBC Driver] CLI0616E Error opening socket. SQLSTATE=08S01 at COM.ibm.db2.jdbc.net.SQLExceptionGenerator.socketE xception(U- nknown Source) at COM.ibm.db2.jdbc.net.DB2Connection.create(Unknown Source) at COM.ibm.db2.jdbc.net.DB2Connection.<init>(Unknown Source) at COM.ibm.db2.jdbc.net.DB2Driver.connect(Unknown Source) at java.sql.DriverManager.getConnection(DriverManager .java:543) at java.sql.DriverManager.getConnection(DriverManager .java:194) at Testingconn1.getConnection(Testingconn1.java:32) at Testingconn1.main(Testingconn1.java:48) -- Posted via http://dbforums.com |