MySQL/Java connection

I'm experiencing some problems during a connection java/mysql in a debian linux. I've got the message
SQL Exception: Unable to connect to any hosts due to exception: java.net.ConnectException: Connection refused
I am using the connector 3.0.8.
When I enter the shell, everything works fine.
Here is the code I've used:
import java.sql.*;
public class DBTest {
public static void main(String[] args) {
try {
Class.forName ("com.mysql.jdbc.Driver");
System.out.println("Driver JDBC loaded!");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/mysql");
} catch (SQLException sqle) {
System.err.println("SQL Exception: " + sqle.getMessage());
} catch (Exception e) {
System.err.println("Exception: " + e.getMessage());
Thanks!
Gilmar

I suspect the problem is the lack of user and pasword. An example of a similar connection I make follows.
public static Connection openSQLConnection(String connectionDriver, String connectionString) {
  errMsg = "Unable to open SQL connection.";
  // Connection reference
  Connection sqlconn = null;
  try {
    // Load database driver
    Class.forName("com.mysql.jdbc.Driver");
    // Make connection
    sqlconn = DriverManager.getConnection("jdbc:mysql://localhost/passport?user=root&password=");
    catch (ClassNotFoundException cnfex) {showSystemError(errMsg,"openSQLConnection - Class not found exception", cnfex, true);}
    catch (SQLException sqlex) {showSystemError(errMsg,"openSQLConnection - SQL exception", sqlex, true);}
    catch (Exception excp) {showSystemError(errMsg,"openSQLConnection - Remaining exceptions", excp, true);}
    return sqlconn;
}Note To avoid confusion - my error handler showSystemError will shut down the system idf the connection fails.
rykk

Similar Messages

  • Java Connector via MySQL [ Cannot Connect ]

    I downloaded the MySql connector and extracted the connector and placed it at this directory,
    C:\Program Files\Java\jdk1.5.0_06\jre\lib\ext
    I also set the classpath as such by adding
    ClassPath = .;C:\Program Files\Java\jdk1.5.0_06\jre\lib\ext\mysql-connector-java-3.1.12-bin.jar.Actually , I followed the tutorial at
    http://www.stardeveloper.com/articles/display.html?article=2003090201&page=4.
    I then executed this program below.
    import java.sql.*;
    public class Connect {
      public static void main(String args[]) {
        Connection con = null;
        try {
         Class.forName("com.mysql.jdbc.Driver").newInstance();
         con = DriverManager.getConnection("jdbc:mysql:///enron", "root", "horizon");
          if(!con.isClosed())
            System.out.println("Successfully connected to MySQL server...");
        } catch(Exception e) {
          System.err.println("Captured Exception: " + e.getMessage());
        } finally {
          try {
            if(con != null)
              con.close();
          } catch(SQLException e) {}
    However i was unable to connect..This is wat happened as below..
    C:\>java Connect
    Captured Exception: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.UnknownHostException
    MESSAGE: localhost: localhost
    STACKTRACE:
    java.net.UnknownHostException: localhost: localhost
            at java.net.InetAddress.getAllByName0(Unknown Source)
            at java.net.InetAddress.getAllByName0(Unknown Source)
            at java.net.InetAddress.getAllByName(Unknown Source)
            at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:137)
            at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:284)
            at com.mysql.jdbc.Connection.createNewIO(Connection.java:2555)
            at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
            at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
            at java.sql.DriverManager.getConnection(Unknown Source)
            at java.sql.DriverManager.getConnection(Unknown Source)
            at Connect.main(Connect.java:7)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 31 ms ago.
    Any Help watsoever is greatly appreciated.
    Thanks in advance.
    Cheers.

    Hi thanks for the reply.
    Although , I am though a bit baffled by your reply.
    Where is it that you want me to add the URL.Not add the URL - change the one you have. Read the docs for the connector and follow that.
    And where else should i place that jar file.I put it in my CLASSPATH, close to where the source for my project is. (That means not in one place, but several places. I duplicate the JAR file for every app that needs it.)
    Cos I follow the tutorial at...
    http://www.stardeveloper.com/articles/display.html?art
    icle=2003090201&page=4.
    Unless You are saying that the above site is wrong..
    If thats the case, can you point out another
    alternative site which can guide me along .No time to read that site, nor do I have the interest.
    The Sun Java tutorial is sufficient for using JDBC. As far as how you package and deploy apps, that's another matter. You should be using the class name and URL that your JDBC driver docs suggest.
    %

  • Java connect to mysql

    hi,im new user here.....im also a new java user.......i've just learn how to connect java with mysql,so i download the driver MySQL Connector/J 5.0
    after that,i mport the library to JBulider X.then i got error with my script.
    package database;
    import java.sql.*;
    public class Mysql {
    public static void main(String[] args) {
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    catch (Exception e){
    System.err.println("Error Loading driver :" + e.getMessage());
    and then the error are :
    java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Class.java:141)
         at database.Mysql.main(Mysql.java:19)
    Exception in thread "main"
    What is that meant ?please someone help me...i need a quick reply......thanxxxsss....

    hello,all.........i just connected to the driver,but now another error come out
    Error SQL Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection refused: connect
    STACKTRACE:
    java.net.SocketException: java.net.ConnectException: Connection refused: connect
         at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
         at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
         at com.mysql.jdbc.Connection.createNewIO(Connection.java:2592)
         at com.mysql.jdbc.Connection.<init>(Connection.java:1509)
         at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
         at java.sql.DriverManager.getConnection(DriverManager.java:512)
         at java.sql.DriverManager.getConnection(DriverManager.java:193)
         at database.Mysql.main(Mysql.java:28)
    ** END NESTED EXCEPTION **
    wat is that mean ?
    this is my script
    package database;
    import java.sql.*;
    public class Mysql {
    public static void main(String[] args) {
    Connection con = null;
    Statement stmt = null;
    ResultSet rs = null;
    try {
    System.out.println("Loading drivers........");
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    System.out.println("Driver loaded !");
    catch (Exception e){
    System.err.println("Error Loading driver :" + e.getMessage());
    try {
    con = DriverManager.getConnection("jdbc:mysql://localhost/test_db?user=test_admin&password=1234");
    stmt = con.createStatement();
    rs = stmt.executeQuery("select * from `stock`");
    ResultSetMetaData rsmd = rs.getMetaData();
    int nColumn = rsmd.getColumnCount();
    for(int i=1;i<=nColumn;i++){
    System.out.print(rsmd.getColumnName(i) + " | ");
    System.out.print("\n");
    /*while(rs.next()){
    System.out.println(rs.getLong(1) + "\t" + rs.getString(2) + "\t" + rs.getLong(3) + "\t" + rs.getString(4) + "\t"
    + rs.getDouble("price") + "\t" + rs.getInt("supplier") + "\t" + rs.getDate("buy_date"));
    rs.close();
    stmt.close();
    con.close();
    catch (SQLException e){
    System.err.println("Error SQL " + e.getMessage());

  • MySQL + Java doesn't work

    I've been trying to get a connection using MySQL and Java without luck, I've been messing with every solution I have found in google without luck. It worked the last time I used mysql + java a few months ago (in Ubuntu) but now I can't even get a connection.
    MySQL works with PHP, MySQL Administrator and CLI but I just can't get it to work with Java.
    Has anybody been able to run Java applications that use JDBC + MySQL in Arch?
    The stack trace I get is like the following and it changes a little bit if I use different versions of the Connector
    java.sql.SQLException: Server connection failure during transaction.
    Due to underlying exception: 'com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.io.EOFException
    STACKTRACE:
    java.io.EOFException
    at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1934)
    at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:483)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:992)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2709)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1485)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at MySQLConnectTest.main(MySQLConnectTest.java:12)
    Last edited by karmapolice (2007-05-22 20:48:25)

    http://bugs.archlinux.org/task/7256
    Added a bug report

  • Error in Mysql database connectivity

    hello,
    there is problem in Mysql database connectivity.
    when i connect JSP program to Mysql database it gives error :
    Server configuration denied access to data source
    please help me asap
    kuldip jain
    [email protected]

    i m also working on Mysql Java but on Window 2000 platform
    here is the Java code which successfully runing on my machine
    import java.sql.*;
    public class TestMySql
         public static void main(String[] Args)
              try
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    Connection C = DriverManager.getConnection(
    "jdbc:mysql://server2:3306/Db?user=root");
    Statement Stmt = C.createStatement();
    ResultSet RS = Stmt.executeQuery("SELECT * from T1");
    while (RS.next()) {
                             System.out.println(RS.getString(1));
    catch (Exception E)
    System.out.println("SQLException: " + E.getMessage());

  • Mysql not connecting

    Hi all
    I have downloaded the J connector, both 5.0.8 and 5.1.13 but they both gives me problems.
    if i try:
    private static String url="jdbc:mysql://localhost:3306/mydb;create=true"; private static Connection conn=null; private Statement stm=null; public static void main(String[] args){ createConnection(); } private static void createConnection(){ try{ Class.forName("com.mysql.jdbc.Driver").newInstance(); //connect conn=DriverManager.getConnection(url); System.out.println("Connected!"); } catch(Exception except){ except.printStackTrace(); } }
    i get the following:
    com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.ConnectException
    MESSAGE: Connection refused
    STACKTRACE:
    java.net.ConnectException: Connection refused
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
    at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:433)
    at java.net.Socket.connect(Socket.java:529)
    at java.net.Socket.connect(Socket.java:477)
    at java.net.Socket.<init>(Socket.java:374)
    at java.net.Socket.<init>(Socket.java:216)
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:256)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:271)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2771)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1555)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:285)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:193)
    at conn.Conn.createConnection(Conn.java:28)
    at conn.Conn.main(Conn.java:18)

         private static String url="jdbc:mysql://localhost:3306/mydb;create=true";
    java.net.ConnectException
    MESSAGE: Connection refusedMySQL is not running in 'localhost' on port 3306.

  • MySQL -- JDBC Connection help !!!

    Hi everybody...Well I have MySQL Server and Java, I get the JDBC and tried this:
    import java.sql.*;
    public class JdbcE {
    public static void main(String args[]) {
    Connection con = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql://localhost/test", "user", "pass");
    if(!con.isClosed())
    System.out.println("Successfully connected to MySQL server...");
    } catch(Exception e) {
    System.err.println("Exception: " + e.getMessage());
    } finally {
    try {
    if(con != null)
    con.close();
    } catch(SQLException e) {}
    And with that code all works fine...but when I change the Host from LOCALHOST to [ROUTER IP] like this:
    con = DriverManager.getConnection("jdbc:mysql://182.185.145.12/test", "user", "pass");
    I got this exception:
    Exception: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection timed out: connect
    STACKTRACE:
    java.net.SocketException: java.net.ConnectException: Connection timed out: conne
    ct
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
    va:156)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
    :266)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at JdbcE.main(JdbcE.java:11)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 16 ms ago.
    I don't know how to solve it...
    I have a 2wire 1700HG router, maybe it would be a problem of the firewall can anyone help me to solve this problem??

    Well I sorry...I am very new in this kind of things...I just know that I have a 2wire 1700HG, I have installed MySQL Server, Java and mysql-connector-java...
    When I try this in the connection statement:
    con = DriverManager.getConnection("jdbc:mysql://localhost/test", "user", "test");
    Everything works fine...but when I try this to connect from a remote PC
    con = DriverManager.getConnection("jdbc:mysql://189.145.185.182/test", "user", "test");
    This error comes out on screen:
    Exception: Communications link failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection timed out: connect
    STACKTRACE:
    java.net.SocketException: java.net.ConnectException: Connection timed out: conne
    ct
    at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.ja
    va:156)
    at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2666)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
    :266)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at JdbcE.main(JdbcE.java:11)
    ** END NESTED EXCEPTION **
    Last packet sent to the server was 16 ms ago.
    I don't know what can I do :S please help!! :D

  • Why my MySQL JDBC Connect fail??

    Dear friends:
    I have following code:
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class JdbcExample2 {
      public static void main(String args[]) {
        Connection con = null;
        try {
          Class.forName("com.mysql.jdbc.Driver").newInstance();
          //jdbc:mysql://host_name:port/dbname
    //     con = DriverManager.getConnection("jdbc:MySQL:///test","admin", "admin");
          con = DriverManager.getConnection("jdbc:MySQL://localhost:3306/test","admin", "admin");
          if(!con.isClosed())
            System.out.println("Successfully connected to " +
              "MySQL server using TCP/IP...");
        } catch(Exception e) {
          System.err.println("Exception: " + e.getMessage());
        } finally {
          try {
            if(con != null)
              con.close();
          } catch(SQLException e) {}
    }But when I run , I got following error:
    Exception: com.mysql.jdbc.Driver
    My question is:
    [1]. when I connect to MySQL Server through mySQL Client, I got
    Enter password: *****
    Welcome to the MySQL monitor. Commands end with ; or \g.
    Your MySQL connection id is 18 to server version: 4.1.21-community-nt
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    mysql>
    how Can I determine MySQL Server name?? I forgot when I install, maybe MySQL is my SQL Server name
    [2]. Do I need to creat a user DSN name or System DSN name for MySQL Server?? which one is best??
    How to do it??
    [3]. How to make above simple JDBC program runnable??
    Thanks
    sunny
    Message was edited by:
    sunnymanman

    Thanks, see new errors:
    C:\Project\java>java Jdbc11
    Copyright 2004, R.G.Baldwin
    java.sql.SQLException: Access denied for user 'admin'@'localhost' (using password: YES)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2941)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:868)
    at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3340)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1238)
    at com.mysql.jdbc.Connection.createNewIO(Connection.java:2743)
    at com.mysql.jdbc.Connection.<init>(Connection.java:1553)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at Jdbc11.main(Jdbc11.java:23)
    C:\Project\java>
    any idea??
    here Jdbc11.java:23 is:
    Connection con = DriverManager.getConnection(
    url,"admin", "YES");
    my userID/Password = admin/admin;
    sunny
    Message was edited by:
    sunnymanman

  • Conecting to mysql database Connection reset by peer

    hi guys,
    I have to connec to sever where , from this place i need to contact a remote database , the databse is behind a firewall , they database in their intranet ,they have give me a valid ip , they have a conection between the valid ip and the intranet system , they give me access to the port in the fire wall , i asked for the port 3306 (mysql default ) port , and tried connecting it but i get exception, should i need to get the 80 port for connection??? please help
    java.sql.SQLException: Communication link failure: java.net.SocketException, underlying cause: Connection reset by peer: Connection reset by peer ** BEGIN NESTED EXCEPTION ** java.net.SocketException MESSAGE: Connection reset by peer: Connection reset by peer STACKTRACE: java.net.SocketException: Connection reset by peer: Connection reset by peer at java.net.SocketInputStream.socketRead(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:86) at java.io.BufferedInputStream.fill(BufferedInputStream.java:186) at java.io.BufferedInputStream.read1(BufferedInputStream.java:225) at java.io.BufferedInputStream.read(BufferedInputStream.java:280) at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1391) at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:1413) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:625) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1782) at com.mysql.jdbc.Connection.(Connection.java:450) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:411) at java.sql.DriverManager.getConnection(DriverManager.java:517) at java.sql.DriverManager.getConnection(DriverManager.java:199) at org.apache.jsp.store$jsp._jspService(store$jsp.java:107) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java: 201) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:381) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:473) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFil terChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain .java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java: 243) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java: 190) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.jav a:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:17 4) at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943) at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:458) at org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551) at java.lang.Thread.run(Thread.java:484) ** END NESTED EXCEPTION **

    yeahman i feel the same, but i need to prove them they need to do some work , for that i should show thm its not my problem , can u tell me how the jdbc connector works,or any other way telling them , the port not opened still , how will the server pass the request to the database , some one please help me

  • XLetview mysql java.lang.notFoundException

    I am programming for TV, I made a basic program that connects to my local database, but when run with the xLetView I get this error when running this line Class.forName ("org.gjt.mm.mysql.Driver ");
    mysql java.lang.notFoundException
    Place the mysql driver in the folder 'jars' of xLetview but nothing works.
    I work with a basic but not with the xLetView.
    Helpme!!!

    There is no such exception. What does the error message really* say? No guessing.

  • SAP Java Connectivity Builder -NoClassDefFoundError com.sap.aii...Reference

    Hi there,
    I'm trying to generate Java Proxies for SAPJCO using the SAP Java Connectivity Builder (JCB). I got it from the NetWeaver 6.20 Release. The tool installs and runs properly but after putting in the connection properties and klicking "next", the application hangs. When activating System output, I get the error shown below.
    I already tried to put all jar files contained in the C:\JBuilder5\lib\ext directiry into the classpath (but none of them contains the class mentioned).
    Which is the right (standalone) tool for generating Java Proxies for a standalone Java application?
    If it is JCB, is there a bug on the version I use (NetWeaver Release 6.20)?
    Any help would be apreciated.
    C:\JBuilder5>java -Dlog.handler.FileLog=FileHandler,log.txt -Dlog.logger.com=ALL,FileLog -cp lib/ext/aii_basis.jar;lib/e
    xt/aii_ifr_core.jar;lib/ext/aii_ifr_jbtool.jar;lib/ext/aii_lcraccess.jar;lib/ext/aii_msg_runtime.jar;lib/ext/aii_proxy_g
    en.jar;lib/ext/aii_proxy_rt.jar;lib/ext/aii_util.jar;lib/ext/aii_util_log.jar;lib/ext/lcrclient.jar;lib/ext/logging.jar;
    lib/ext/SapIdeHelp.jar;lib/ext/SapIdeJBUtil.jar;lib/ext/SapIdeJspInsight.jar;lib/ext/SapIdeTaglibReflection11.jar;lib/ex
    t/SapIdeTracing.jar;lib/ext/SapIdeUtil.jar;lib/ext/SAPJ2EEEngineJBuilderPlugin.jar;lib/ext/sapjco.jar;lib/ext/SAPmdi.jar
    ;lib/ext/servlet.jar;lib/ext/tc_sec_core.jar com.sap.aii.ifr.tool.jbuilder.JBuilderTool
    #0 12:35:37 [main] DEBUG com.sap.aii.util.misc.api.AIIProperties: Initial AIIProperties
            com.sap.aii.client = true
    #1 12:35:37 [main] FINE com.sap.aii.util.misc.api.AIIProperties: changed Property "com.sap.aii.standalone" from "null" t
    o "true"
    #2 12:35:37 [main] FINE com.sap.aii.util.misc.api.AIIProperties: changed Property "com.sap.aii.xml.parserFactory" from "
    null" to "com.inqmy.lib.jaxp.SAXParserFactoryImpl"
    #3 12:35:37 [main] FINE com.sap.aii.util.misc.api.AIIProperties: changed Property "com.sap.aii.xml.transformerFactory" f
    rom "null" to "com.inqmy.lib.jaxp.TransformerFactoryImpl"
    #4 12:35:46 [AWT-EventQueue-0] DEBUG com.sap.aii.ifr.upload.client.SAPNavigationPane: New file is C:\Documents and Setti
    ngs\kalkoo1\Desktop\t.jar
    #5 12:36:08 [AWT-EventQueue-0] FINER com.sap.aii.ifr.upload.client.R3LogonScreen: setting for Client : 010
    #6 12:36:08 [AWT-EventQueue-0] FINER com.sap.aii.ifr.upload.client.R3LogonScreen: setting for Logon Name : kalkoo1
    #7 12:36:08 [AWT-EventQueue-0] FINER com.sap.aii.ifr.upload.client.R3LogonScreen: setting for Password : #########
    #8 12:36:08 [AWT-EventQueue-0] FINER com.sap.aii.ifr.upload.client.R3LogonScreen: setting for Language : EN
    #9 12:36:08 [AWT-EventQueue-0] FINER com.sap.aii.ifr.upload.client.R3LogonScreen: setting for Host name: bgstsapedai01.s
    t.behr.de
    #10 12:36:08 [AWT-EventQueue-0] FINER com.sap.aii.ifr.upload.client.R3LogonScreen: setting for System number : 20
    #11 12:36:08 [AWT-EventQueue-0] INFO com.sap.aii.ifr.upload.client.R3LogonScreen: trying to establish connection
    #12 12:36:08 [AWT-EventQueue-0] FINEST com.sap.aii.ifr.util.IdentityCheck: Looking up identity
    #13 12:36:08 [AWT-EventQueue-0] DEBUG com.sap.aii.ifr.util.IdentityCheck: Results of identity check: isIFRServer: false;
    isIFRRMIClient: false; isStandaloneIFR: true
    #14 12:36:08 [AWT-EventQueue-0] FINEST com.sap.aii.ifr.util.IdentityCheck: Checking IdentityCheck.isIFRServer. Result: f
    alse
    #15 12:36:08 [AWT-EventQueue-0] INFO com.sap.aii.ifr.upload.sap.SAPConnection: connecting to system 20 on bgstsapedai01.
    st.behr.de via JCo
    #16 12:36:09 [AWT-EventQueue-0] DEBUG com.sap.aii.ifr.upload.sap.SAPUploadSource: init MDI to System bgstsapedai01.st.be
    hr.de (system=20, client=010) (BasisRelease: 620)
    #17 12:36:09 [AWT-EventQueue-0] DEBUG com.sap.aii.ifr.upload.UploadBuffer: new UploadBuffer
    Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/sap/aii/ifr/client/editor/Reference
            at java.lang.Class.getDeclaredMethods0(Native Method)
            at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
            at java.lang.Class.getDeclaredMethod(Unknown Source)
            at java.awt.Component.isCoalesceEventsOverriden(Unknown Source)
            at java.awt.Component.access$100(Unknown Source)
            at java.awt.Component$2.run(Unknown Source)
            at java.awt.Component$2.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.awt.Component.checkCoalescing(Unknown Source)
            at java.awt.Component.<init>(Unknown Source)
            at java.awt.Container.<init>(Unknown Source)
            at javax.swing.JComponent.<init>(Unknown Source)
            at javax.swing.JTree.<init>(Unknown Source)
            at javax.swing.JTree.<init>(Unknown Source)
            at com.sap.aii.ifr.navigation.IFRJTree.<init>(IFRJTree.java:84)
            at com.sap.aii.ifr.navigation.IFRTreePane.buildPane(IFRTreePane.java:123)
            at com.sap.aii.ifr.navigation.IFRTreePane.<init>(IFRTreePane.java:33)
            at com.sap.aii.ifr.upload.client.SAPNavigationPane.<init>(SAPNavigationPane.java:43)
            at com.sap.aii.ifr.upload.client.SAPBrowser.setIsConnected(SAPBrowser.java:252)
            at com.sap.aii.ifr.upload.client.SAPBrowser$ConnectAction.actionPerformed(SAPBrowser.java:594)
            at com.sap.aii.ifr.upload.client.SAPBrowser$NextAction.actionPerformed(SAPBrowser.java:536)
            at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
            at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
            at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
            at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
            at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
            at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
            at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
            at java.awt.Component.processMouseEvent(Unknown Source)
            at javax.swing.JComponent.processMouseEvent(Unknown Source)
            at java.awt.Component.processEvent(Unknown Source)
            at java.awt.Container.processEvent(Unknown Source)
            at java.awt.Component.dispatchEventImpl(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
            at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
            at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
            at java.awt.Container.dispatchEventImpl(Unknown Source)
            at java.awt.Window.dispatchEventImpl(Unknown Source)
            at java.awt.Component.dispatchEvent(Unknown Source)
            at java.awt.EventQueue.dispatchEvent(Unknown Source)
            at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
            at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.run(Unknown Source)

    Hi,
    >> Error :- java.lang.NoClassDefFoundError: com/sap/aii/security/proxy/KeystoreHelp
    1) Can you check the class path  you have mentioned  is correctly
    2) Setting of the Java in your system ( Desk top /Lap top ) check the Proxy settings
    3) Re start the J2EE engine in the server
    Regards
    Agasthuri Doss

  • Crystal XI R2, Salesforce 3.0, Windows 7 64-bit, Java connection error

    All,
    I've got the same problem as this thread -- Re: CR XI R2: Salesforce 3.0 driver on Windows 7 64-bit?
    Crystal XI R2, Salesforce 3.0 downloaded from the Crystal page.  Using Windows 7 64-bit.  Have applied SP 5 per another thread.
    Continue to get JAVA error.  Java being used is 1.4 as installed by Crystal in the Crystal program directory.
    thanks, jhb

    Don,
    Still no go.  I get the same error.
    I uninstalled SP6, SP5, Salesforce Connector, and Crystal XI R2 SP2 and then re-installed everything.
    1) Crystal XI R2 SP2
    2) Salesforce connector 3.0
    3) SP5
    4) SP6
    Still get the same Java Connection error.  I've also disabled Windows Firewall.  I'm not behind a proxy.  I've tried with and without the security token.
    thanks, jhb

  • How to establish a MYSQL Database connection in JSP page.

    Hi People,
    Tell me how to establish mysql database connection in JSP page.
    Needed details on:
    1) what are all the mysql drivers need to be included.
    2) what is the syntax for establish a database connection

    hi,
    http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.htmlsee down for mysql config with tomcat

  • MySQL gateway connection

    Looks like plenty of folks here have similar problems getting the dg4odbc gateway working for MySQL. Hope someone that's tackled this can help me out.
    Our configuration is such that we have our gateway machine separate from our Oracle database, and the MySQL machine is yet another server. We have installed and configured the gateway along with the unixODBC gateway and the MySQL connector. Running ./isql from the gateway successfully connects to the MySQL database and returns rows from specified tables.
    Our difficulty is with setting up the listener.ora (on the gateway) and tnsnames.ora (on the Oracle host). Here are the contents of those files:
    listenter.ora:
    SID_LIST_LISTENER =
        (SID_DESC =
          (PROGRAM = dg4odbc)
          (ORACLE_HOME=/db01/app/oracle/product/gateways)
          (SID_NAME = myodbc3)
          (ENVS=LD_LIBRARY_PATH=/opt/unixODBC/lib:/opt/mysql/myodbc5/lib:/usr/local/lib:/db01/app/oracle/product/gateways/lib)
    LISTENER =
      (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
          (ADDRESS = (PROTOCOL = TCP)(HOST = gw_host)(PORT = 1521))
      )tnsnames.ora:
    dg4odbc =
      (DESCRIPTION =
        (ADDRESS_LIST =
          (ADDRESS = (PROTOCOL = TCP)(HOST = gw_host)(PORT = 1521))
        (CONNECT_DATA = (SID= myodbc3))
        (HS=OK)
      )Listener status on the gateway is:
    -bash-3.00$ lsnrctl status
    LSNRCTL for Solaris: Version 11.1.0.6.0 - Production on 26-APR-2010 15:07:08
    Copyright (c) 1991, 2007, Oracle.  All rights reserved.
    Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
    STATUS of the LISTENER
    Alias                     LISTENER
    Version                   TNSLSNR for Solaris: Version 11.1.0.6.0 - Production
    Start Date                26-APR-2010 14:41:51
    Uptime                    0 days 0 hr. 25 min. 17 sec
    Trace Level               off
    Security                  ON: Local OS Authentication
    SNMP                      OFF
    Listener Parameter File   /db01/app/oracle/product/gateways/network/admin/listener.ora
    Listener Log File         /db01/app/oracle/diag/tnslsnr/ozone4/listener/alert/log.xml
    Listening Endpoints Summary...
      (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
      (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gw_host)(PORT=1521)))
    Services Summary...
    Service "myodbc3" has 1 instance(s).
      Instance "myodbc3", status UNKNOWN, has 1 handler(s) for this service...
    The command completed successfullyCan anyone see anything obvious in this configuration that's out of whack?
    I logged into sqlplus and create a public database link:
    SQL> create public database link mysql
      2   connect to user_name identified by password
      3  using 'dg4odbc';Executing a query via the link gives the following:
    SQL> select * from block@mysql;
    select * from block@mysql
    ERROR at line 1:
    ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
    ORA-02063: preceding line from MYSQLAnyone seen this before or have any ideas for me? I've read through the docs and this forum and just cannot see where the problem lies.
    Earl
    P.S. tnsping from the Oracle database to the gateway gives this:
    merc@: tnsping dg4odbc
    TNS Ping Utility for Linux: Version 10.2.0.4.0 - Production on 26-APR-2010 15:15:07
    Copyright (c) 1997,  2007, Oracle.  All rights reserved.
    Used parameter files:
    /opt/oracle/product/10.2.0/db_1/network/admin/sqlnet.ora
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = gw_host)(PORT = 1521))) (CONNECT_DATA = (SID= myodbc3)) (HS=OK))
    OK (0 msec)

    >
    Maybe it is sufficient to get the part where the libodbc.so library is loaded, so check where you'll find it in the strace file and provide this info until the error is visible in the traceHopefully this is what you wanted from truss.
    23074/1:     stat("/opt/unixODBC/lib/libodbc.so", 0xFFFFFFFF7FFFD4A0) = 0
    23074/1:     resolvepath("/opt/unixODBC/lib/libodbc.so", "/opt/unixODBC/lib/libodbc.so.1.0.0", 1023) = 34
    23074/1:     open("/opt/unixODBC/lib/libodbc.so", O_RDONLY)     = 9
    23074/1:     mmap(0x00100000, 32768, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_ALIGN, 9, 0) = 0xFFFFFFFF7A400000
    23074/1:     mmap(0x00100000, 1826816, PROT_NONE, MAP_PRIVATE|MAP_NORESERVE|MAP_ANON|MAP_ALIGN, -1, 0) = 0xFFFFFFFF7A200000
    23074/1:     mmap(0xFFFFFFFF7A200000, 719355, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_TEXT, 9, 0) = 0xFFFFFFFF7A200000
    23074/1:     mmap(0xFFFFFFFF7A3AE000, 55864, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_INITDATA, 9, 712704) = 0xFFFFFFFF7A3AE000
    23074/1:     mmap(0xFFFFFFFF7A3BC000, 1552, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_ANON, -1, 0) = 0xFFFFFFFF7A3BC000
    23074/1:     munmap(0xFFFFFFFF7A2B0000, 1040384)          = 0
    23074/1:     memcntl(0xFFFFFFFF7A200000, 75448, MC_ADVISE, MADV_WILLNEED, 0, 0) = 0
    23074/1:     close(9)                         = 0
    23074/1:     stat("/opt/unixODBC/lib/libdl.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/opt/mysql/myodbc5/lib/libdl.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/usr/local/lib/libdl.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/db01/app/oracle/product/gateways/lib/libdl.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/opt/unixODBC/lib/libthread.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/opt/mysql/myodbc5/lib/libthread.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/usr/local/lib/libthread.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/db01/app/oracle/product/gateways/lib/libthread.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/opt/unixODBC/lib/libc.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/opt/mysql/myodbc5/lib/libc.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/usr/local/lib/libc.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/db01/app/oracle/product/gateways/lib/libc.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/opt/unixODBC/lib/libgcc_s.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/opt/mysql/myodbc5/lib/libgcc_s.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/usr/local/lib/libgcc_s.so.1", 0xFFFFFFFF7FFFD230) = 0
    23074/1:     resolvepath("/usr/local/lib/libgcc_s.so.1", "/usr/local/lib/libgcc_s.so.1", 1023) = 28
    23074/1:     open("/usr/local/lib/libgcc_s.so.1", O_RDONLY)     = 9
    23074/1:     mmap(0xFFFFFFFF7A400000, 32768, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 9, 0) = 0xFFFFFFFF7A400000
    23074/1:     close(9)                         = 0
    23074/1:     stat("/db01/app/oracle/product/gateways/lib/libgcc_s.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/lib/64/libgcc_s.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     stat("/usr/lib/64/libgcc_s.so.1", 0xFFFFFFFF7FFFD230) Err#2 ENOENT
    23074/1:     munmap(0xFFFFFFFF7A200000, 719355)          = 0
    23074/1:     munmap(0xFFFFFFFF7A3AE000, 58892)          = 0
    23074/1:     munmap(0xFFFFFFFF7A400000, 32768)          = 0
    23074/1:     write(7, "   h o a e r r : 2 8 5 0".., 14)     = 14
    23074/1:     time()                              = 1273255397
    23074/1:     write(7, " E x i t i n g   h g o l".., 40)     = 40
    23074/1:     write(7, " F a i l e d   t o   l o".., 81)     = 81
    23074/1:     time()                              = 1273255397
    23074/1:     write(7, " E x i t i n g   h g o l".., 49)     = 49
    23074/1:     time()                              = 1273255397
    23074/1:     write(7, " E x i t i n g   h g o i".., 126)     = 126
    23074/1:     getpid()                         = 23074 [5550]
    23074/1:     open("/proc/23074/map", O_RDONLY)          = 9
    23074/1:     fstat(9, 0xFFFFFFFF7FFFD1F8)               = 0
    23074/1:     open("/dev/zero", O_RDWR)               = 12
    23074/1:     mmap(0x00000000, 14872, PROT_READ|PROT_WRITE, MAP_PRIVATE, 12, 0) = 0xFFFFFFFF7AC00000
    23074/1:     pread(9, "\0\0\001\0\0\0\0\0\0\0\0".., 14872, 0) = 7488
    23074/1:     close(9)                         = 0
    23074/1:     munmap(0xFFFFFFFF7AC00000, 7592)          = 0
    23074/1:     write(7, " h o s t m s t r :      ".., 41)     = 41
    23074/1:     write(14, "\0 *\0\006\0\0\0\0\080\0".., 42)     = 42
    23074/1:     read(14, "\0 n\0\006\0\0\0\0\0 H\0".., 8208)     = 110
    23074/1:     getpid()                         = 23074 [5550]
    23074/1:     open("/proc/23074/map", O_RDONLY)          = 9
    23074/1:     fstat(9, 0xFFFFFFFF7FFFD4D8)               = 0
    23074/1:     open("/dev/zero", O_RDWR)               = 13
    23074/1:     mmap(0x00000000, 15080, PROT_READ|PROT_WRITE, MAP_PRIVATE, 13, 0) = 0xFFFFFFFF7A400000
    23074/1:     pread(9, "\0\0\001\0\0\0\0\0\0\0\0".., 15080, 0) = 7592
    23074/1:     close(9)                         = 0
    23074/1:     munmap(0xFFFFFFFF7A400000, 7696)          = 0
    23074/1:     write(7, " h o s t m s t r :      ".., 44)     = 44
    23074/1:     getpid()                         = 23074 [5550]
    23074/1:     open("/proc/23074/map", O_RDONLY)          = 9
    23074/1:     fstat(9, 0xFFFFFFFF7FFFD358)               = 0
    23074/1:     open("/dev/zero", O_RDWR)               = 15
    23074/1:     mmap(0x00000000, 15288, PROT_READ|PROT_WRITE, MAP_PRIVATE, 15, 0) = 0xFFFFFFFF7A300000
    23074/1:     pread(9, "\0\0\001\0\0\0\0\0\0\0\0".., 15288, 0) = 7696
    23074/1:     close(9)                         = 0There appear to be errors there but I have no idea how to read this output. Thanks again for your help.
    Earl

  • ABAP Java connectivity

    Hi ABAPers,
    I want to have a sample program for SAP Java connectivity. I know SAP has a JCo but how to go about it. We have another system which needs to communicate with SAP 4.6C. Also, I would like to know whether while reading tables from other system, can this program update our tables.
    Thanking you.

    Hi,
    To use JCo, download it (including the Javadocs) from http://service.sap.com/connectors. The zip file contains a comprehensive tutorial to program using JCo. You can also take a look at the FAQ on JCo at http://www.sapgenie.com/faq/jco.htm for more information.
    If you just want to take a look at the sample code, you can download the tutorial from http://zerone.samcheok.ac.kr/Asp_pr/Language/.%5Cuploadfile%5CJCo%20Tutorial-1.pdf
    You can definitely use JCo to update tables in SAP. You will either have to call an existing BAPI, or an RFC FM to do so.
    Hope this helps. Let us know if you need further assistance.
    Regards
    Message was edited by: Shehryar Khan
    Message was edited by: Shehryar Khan

Maybe you are looking for