Unable to connect java to mysql

I have installed mysql on my linux machine (i didnt modify any default configuration settings, just using the default settings). And in my lan, from another machine in windows from my java code i am trying to connect to mysql of linux, but donno why i get connection refused error. Can someone help me to figure what the steps i am missing or need to do?

Thanks for your reply. I do not have any network managers. I have installed mysql on my linux machine and also started mysql. Now in remote machine i have downloaded mysql-connector-java-5.0.4-bin.jar file and using this jar file my java code is trying open a connection to mysql.
          try {
               Class.forName("com.mysql.jdbc.Driver");
          }catch(Exception ce) {ce.printStackTrace();}
          try {
               Connection conn = DriverManager.getConnection("jdbc:mysql://192.168.20.160:3306/mysql","root","new_password");192.168.20.160 is the linux machine where mysql is running.
But of no use, i get connection refused error. following is stacktrace
SQLException: 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:2666)
     at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
     at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
     at java.sql.DriverManager.getConnection(DriverManager.java:525)
     at java.sql.DriverManager.getConnection(DriverManager.java:171)
     at TestDriver.main(TestDriver.java:11)
** END NESTED EXCEPTION **
Last packet sent to the server was 63 ms ago.
SQLState: 08S01
VendorError: 0

Similar Messages

  • Cannot connect java to mysql server 2000

    I was unable to connect to the mysql server 2000 with the jcreator.
    The following exception was thrown:
    java.net.SocketException
    MESSAGE: java.net.ConnectException: Connection refused: connect
    STACKTRACE:
    java.net.SocketException: java.net.ConnectException: Connection refused: connect at com.mysql.jdbs.StandardSocketFactory.connect<StandardSocketFactory.java:156?
    at com.mysql.jdbc.MysqlIO.<init><MysqlIO.java:284>
    ** END NESTED EXCEPTION **
    and the code i used was :
    package com.stardeveloper.example;
    import java.sql.*;
    public class JCustomer {
    public static void main(String args[]) {
    Connection con = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql:///Customer", "user", " ");
    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) {}
    I donot have any user and pwd for the MYsql server, it is local host connection and window authentication is used.

    eventhough it is local ,you may need to specify dns/localhost/ip with port number.
    otherwise you can use myODBC driver which is freely available in mysql website. you can connect to the database using Data source Name, just like using any other ODBC connectivity.

  • Can' t connect Java with MySQL

    My goal is to connect Java with MySQL. I found many solutions on Internet, but I always get the same mistake:
    SQLException: No suitable driver
    SQLState: 08001
    VendorError: 0MySQL works fine alone or with php.Only thing left me to think is that the installed versions are not compatible for this mysql-connector-java-5.0.4
    I don't believe that could be a reason.
    Installed versions are:
    Apache Tomcat 5.5.20 Server
    Apache HTTP Server 2.2.4
    PHP 5.2.0
    MySQL 5.2
    jre 1.5.0_11
    jdk1.5.0_11
    Apache Tomacat JK2 connector Version: 1.2.20 File Name: mod_jk-apache-2.2.3.so
    mysql-connector-java-5.0.4
    I also set connector in class path: C:\mysql-connector-java-5.0.4;C:\mysql-connector-java-5.0.4\mysql-connector-java-5.0.4-bin.jar;C:\mysql-connector-java-5.0.4\src\com\mysql\jdbc
    For installation I used manulas from:
    http://apacheguide.org/jsp.php
    http://doc.51windows.net/mysql/?url=/MySQL/ch23s03.html
    Here is also a test code in java:
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
       public class Connect
           public static void main (String[] args)
               Connection conn = null;
               try {
        conn =
           DriverManager.getConnection("jdbc:mysql://localhost/first_test" +
                                       "user=monty&password=greatsqldb");
        // Do something with the Connection
    } catch (SQLException ex) {
        // handle any errors
        System.out.println("SQLException: " + ex.getMessage());
        System.out.println("SQLState: " + ex.getSQLState());
        System.out.println("VendorError: " + ex.getErrorCode());
       }i'm desperate, please help or tell me someone who'll know the answer.
    Thank You in advance

    hey buddy .. it seems yr code is wrong .. in getconnection () method u should also specify the port ,which u r not doing ...
    the default port for MySQL is 3306 ... see below i am giving you a sample code ... its working fine .. and dont forget to put the MySQL driver jar path in to classpath and also copy the jar into common/lib folder of your tomcat ....
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class MySQLConnectionTest {
         public static void main(String[] args) {
    new MySQLConnectionTest().connTest();
    public void connTest() {
              String tableName = "portfolio"; //change as per setting
              String hostName = "10.81.9.39"; // please change for the target database ip or hostname
              String dbPort = "3306"; //change if not using the default
              String dbName = "tradingsystem"; //change as per the given DB name
              String username = "root"; //change as per setting
              String password = "password"; //change as per setting
              System.out.println("before try");
              Double data=0.0;
         Double data1=0.0;
              try {
    Class.forName("org.gjt.mm.mysql.Driver");
                   System.out.println("before driver manager");
    Connection conn = DriverManager.getConnection("jdbc:mysql://"+hostName+":"+dbPort+"/"+dbName, username, password);
    String query1 = "select * from "+tableName+" where User_id='trader1' and Stock_Type='Equity'";
    System.out.println("quesry1="+query1);
    Statement stmt = conn.createStatement();
    ResultSet rs1 = stmt.executeQuery(query1);
    while(rs1.next())
         System.out.println("hiiiiii for rs1");
         System.out.println(rs1);
         Quantity=(Integer)rs1.getObject(5);
         MarketPrice=(Double) rs1.getObject(8);
         data=Quantity*MarketPrice;
         data1+=data;
         System.out.println("data1="+data1);
         i=0;
    rs1.close();
    stmt.close();
    conn.close();
    } catch (ClassNotFoundException e) {
    e.printStackTrace(System.err);
    } catch (SQLException e) {
    e.printStackTrace(System.err);
    i hope it will work for u...
    cheers,

  • Unable to connect JAVA with Oracle

    I have jdk1.6 and oracle installed on my machine but unable to connect java with database
    have classes12.jar and ojdbc14.jar
    my environmental variables in respect to this are :
    JAVA_HOME= C:\Java\jdk1.6.0_04
    JRE_HOME=C:\Java\jdk1.6.0_04
    PATH=J:\oracle\ora92\lib;
    J:\oracle\ora92\bin;
    C:\Program Files\Oracle\jre\1.3.1\bin;
    C:\Program Files\Oracle\jre\1.1.8\bin
    CLASSPATH=J:\oracle\ora92\jdk\jre\bin\JdbcOdbc.dll;
    J:\oracle\ora92\jdbc\lib\classes12.jar;
    J:\oracle\ora92\jdbc\lib\ojdbc14.jar
    The code is
    import java.sql.*; public class dat1 {               public static void main(String[] args)throws SQLException,ClassNotFoundException {         try     {     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");     Class.forName("com.oracle.jdbc.OracleDriver");     } catch (ClassNotFoundException e) { System.out.println("unable to load driver"); return; }     } }
    the error message is
    Error in thread "main" java.lang.NoClassDefFoundError
    Please Help Me
    Thanks For Reading
    Thanks a lot in Advance For your ANSWERS

    maybe if you asked nicely instead of ordering people around we might tell you.
    As it is all you're going to hear is that you don't need both those jars, as they contain different versions of the same driver.
    I'm not going to tell you which you need, as you should have the documentation to tell you that. But then you also should have the documentation to tell you how to set your classpath properly and you failed to read that too.

  • How to connect java in mysql....

    how to connect java in mysql.... help me guys
    am newbie...

    http://www.mysql.com/products/connector/j/
    download the JDBC driver and read the docs.
    if you don't know JDBC, Google for "Sun JDBC tutorial" and study it.
    don't ask for sample code. there's plenty out there.
    %

  • Unable to connect JSP and MySQL

    Hi, I am new to this forum
    I've started developing web pages using JSP
    I've the problem connecting JSP and MySQL database. I've created the page that retrive records from mysql table. But the connection fail to access to database it gives me this error:
    org.apache.jasper.JasperException: Exception in JSP: /retreive_book.jsp:15
    The code is:
    12: <%
    13: //Class.forName("com.mysql.jdbc.Driver").newInstance();
    14: Class.forName("org.gjt.mm.mysql.Driver");
    15: connection = DriverManager.getConnection(connectionURL,"","");
    16: statement = connection.createStatement();
    17: rs = statement.executeQuery("SELECT * FROM books_detail");
    18: %>
    And the connectionURL parameter has this value:
    String connectionURL = "jdbc:mysql://localhost:3306/books?username=;password=";
    root cause msg is:
    java.sql.SQLException: Invalid authorization specification: Access denied for user 'nobody'@'localhost' (using password: NO)
    Please can anyone help me. It is 3 days now trying to do that but not succeded yet

    Hi
    Yes It is true that my MySQl installation its username is root. So how should put that in the url. Cause I did that but it didn.t work
    String connectionURL= "jdbc:mysql://localhost:3306/books?username=root;password=";
    If I write in that manner is it correct for root username or should I put a single quote
    Thanks

  • Hoe to connect java with mysql 5.0

    I have installed the new Os. in that RHE-5 Os is there, now I want that java can connect ot mysql but , its not able connect with mysql so please guide me.

    1) download mysql connector/J JDBC driver from mysql.com
    2) put the driver jar somewhere where you can put it in the classpath of your application
    3) use proper setup code to connect to the database (search google, tons of examples)
    If at any step you have no clue what I am talking about, you need a good book to help you further.

  • Connectivity java with mySql

    Hi
    Can any one tell me how should i connect my java application with mySql database here is the small code which i written.
    import java.sql.*;
    class tryjdbc
         public static void main(String[] args) throws Exception
         try
              Class.forName("com.mysql.jdbc.Driver").newInstance();
              String connectionURL = "jdbc:mysql://localhost:3306/learn?user=root;password=";
              Connection connection = DriverManager.getConnection(connectionURL, "root", "");
              Statement statement = connection.createStatement();
              ResultSet rs = statement.executeQuery("Select ecode from emp");
              while (rs.next())
                   System.out.println(rs.getString("ecode"));
              catch (Exception e){
                   System.out.println(e);
    Can any one please tell me the error there is no eror in compiling but at run time it gives error
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    Thanks in advance
    Dhiraj

    Hi Dhiraj,
    String connectionURL = "jdbc:mysql://localhost:3306/learn?user=root;password=";
    Connection connection = DriverManager.getConnection(connectionURL, "root", "");
    It seems to be your trying to pass twice of your properties details. One from through URL and another from by pasing the parameters on getConnection() method. Better to avoid to use two place in same application. and one more thing I want to confirm r u using "stable" Driver or "alpha" Driver.
    Raju

  • Steps cor connectivity java and mysql

    Hi can any one list the steps for the connectivity of java & mysql.
    jdk1.6 & mysql5

    1) Learn JDBC: http://java.sun.com/docs/books/tutorial/jdbc/index.html
    2) Obtain the MySQL JDBC driver: http://www.mysql.com/products/connector/j/
    3) Read the MySQL JDBC driver reference documentation: http://dev.mysql.com/doc/refman/6.0/en/connector-j-reference.html

  • Unable to Connect java through LCDS

    Hi,
    I want to connect to java classes through LCDS. I am using flash builder 4, Eclipse Ganymade, Tomcat server.
    Error Looks like this
    [LCDS]Deserializing AMF/HTTP request
    Version: 3
      (Message #0 targetURI=null, responseURI=/2)
        (Array #0)
          [0] = (Typed Object #0 'flex.messaging.messages.RemotingMessage')
            operation = "authenticateUser"
            source = null
            clientId = null
            timeToLive = 0
            timestamp = 0
            headers = (Object #1)
              DSEndpoint = null
              DSId = "671AE2EC-CA0C-B16A-27D9-587F05B8F1A1"
            messageId = "90B2CF64-5275-B21D-7185-D9A14E00DB0B"
            destination = "TestService"
            body = (Array #2)
              [0] = "administrator"
              [1] = "password"
    <<<<<<<<<<Entering authenticateUser:UserManagementService>>>>>>>>>administrator:
    ::::password
    com.adobe.idp.um.api.UMException| [com.adobe.livecycle.usermanager.client.Authen
    ticationManagerServiceClient] errorCode:16385 errorCodeHEX:0x4001 message:Error
    wrapped in DSCException : TRACE
            at com.adobe.livecycle.usermanager.client.ManagerServiceClient.throwErro
    rAsUMException(ManagerServiceClient.java:57)
            at com.adobe.livecycle.usermanager.client.ManagerServiceClient.handleExc
    eption(ManagerServiceClient.java:92)
            at com.adobe.livecycle.usermanager.client.AuthenticationManagerServiceCl
    ient.authenticate(AuthenticationManagerServiceClient.java:113)
            at com.adobe.solutions.ffa.util.UserManagementUtil.validateUser(UserMana
    gementUtil.java:19)
            at com.adobe.solutions.ffa.service.UserManagementService.authenticateUse
    r(UserManagementService.java:10)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at flex.messaging.services.remoting.adapters.JavaAdapter.invoke(JavaAdap
    ter.java:421)
            at flex.messaging.services.RemotingService.serviceMessage(RemotingServic
    e.java:183)
            at flex.messaging.MessageBroker.routeMessageToService(MessageBroker.java
    :1400)
            at flex.messaging.AsyncMessageBroker.routeMessageToService(AsyncMessageB
    roker.java:571)
            at flex.messaging.endpoints.AbstractEndpoint.serviceMessage(AbstractEndp
    oint.java:1005)
            at flex.messaging.endpoints.amf.MessageBrokerFilter.invoke(MessageBroker
    Filter.java:103)
            at flex.messaging.endpoints.amf.LegacyFilter.invoke(LegacyFilter.java:15
    8)
            at flex.messaging.endpoints.amf.SessionFilter.invoke(SessionFilter.java:
    44)
            at flex.messaging.endpoints.amf.BatchProcessFilter.invoke(BatchProcessFi
    lter.java:67)
            at flex.messaging.endpoints.amf.SerializationFilter.invoke(Serialization
    Filter.java:165)
            at flex.messaging.endpoints.BaseHTTPEndpoint.service(BaseHTTPEndpoint.ja
    va:293)
            at flex.messaging.MessageBrokerServlet.service(MessageBrokerServlet.java
    :352)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:233)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:191)
            at flex.messaging.security.TomcatValve.invoke(TomcatValve.java:151)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:128)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:102)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
    a:293)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
    :849)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
    ss(Http11Protocol.java:583)
            at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:45
    4)
            at java.lang.Thread.run(Unknown Source)
    error: Error wrapped in DSCException : TRACE[LCDS]Adapter 'java-object' called '
    com.adobe.solutions.ffa.service.UserManagementService.authenticateUser(java.util
    .Arrays$ArrayList (Collection size:2)
      [0] = administrator
      [1] = password
    [LCDS]Result: 'true'
    [LCDS]Serializing AMF/HTTP response
    Version: 3
      (Message #0 targetURI=/2/onResult, responseURI=)
        (Externalizable Object #0 'DSK')
          true
    1.262076645285E12
    (Byte Array #1, Length 16)
    (Byte Array #2, Length 16)
    (Byte Array #3, Length 16)
    Plz help me in fixing this issue....
    With regards,
    yashu

    maybe if you asked nicely instead of ordering people around we might tell you.
    As it is all you're going to hear is that you don't need both those jars, as they contain different versions of the same driver.
    I'm not going to tell you which you need, as you should have the documentation to tell you that. But then you also should have the documentation to tell you how to set your classpath properly and you failed to read that too.

  • Unable to connect to MySQL database

    Hello,
    I have written a DatabaseManager class that controls access to a locally stored database, implemented in mysql. In theory, client request should be passed to the DatabaseManager through RMI, but I cannot even create a connection to the database yet!
    Here's my connect statement:
    con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/media", "mysql", "mysql");When this statement is executed, the following exception is produced:
    java.sql.SQLException: Unable to connect to any hosts due to exception: java.security.AccessControlException: access denied (java.util.PropertyPermission file.encoding read)Can somebody explain to me how I successfully create a connection to the database? I would be extremely grateful. Also, could somebody explain how I could connect to the database from a remote machine using the following connect statement:
    con = DriverManager.getConnection("jdbc:mysql://server:3306/media", "mysql", "mysql");I have a feeling I need to grant a certain PropertyPermission in my policy file, but I'm unsure of what values I should be using.
    Thank you in advance.
    Pete

    Thank you for the prompt reply.
    In answer to you question: No, it is not an applet. The DatabaseManager is a class that implements a Remote interface, I have it running on the same machine as the mysql database (the server). I then have a small GUI that runs on a client machine which is used to make RMI calls to the DatabaseManager across the network in order to query the database.
    When the DatabaseManager object is spawned on the server, it tries to connect to the database to be ready for client queries. This is when it produces the exception mentioned in the original post.
    What confuses me is that in my original implementation, the DatabaseManager object was run on the client and the mysql JDBC had no difficulty in connecting to the database across the network. Could the security manager have something to do with it? I am using the RMISecurityManager in conjunction with the java.policy file from the Java RMI tutorial on the Sun website.
    Pete

  • Unable to connect to mysql using JSP servlet

    Respected Sir/Madam
    I have made a jsp application and use tomcat 4 and mysql .Whenever there is a db connection the application tries to connect.but then it throws exception
    java.sql.SQLException: Unable to connect to any hosts due to exception: java.net.ConnectException: Connection timed out: connect
    This error started occuring all of a sudden and i am not getting its root cause...Can anybody help me out of this...?
    I am having intranet. And one thing that amazed me was when I send request for that JSP page from different machine then it connected to db without any error..Only when I request that JSP page from my machine it is giving me this error.
    Please help..
    Waiting for your reply.
    Thanks and Regards

    Microsoft Telnet> open Oracleserver
    Connecting To Oracleserver...Could not open a
    connection to host: Connect failedYou need to run the exact command i gave you from the command line. There may not be a telnet server running on OracleServer, you are trying to connect to port 23 with the command above.
    run 'telnet Oracleserver 3306'
    If this does not work, try the same thing with the IP address instead of 'Oracleserver', you may have a name resolution issue.
    I didnt understood this .I also tried running this
    command from other machines where my application is
    running fine. But there also the same error.
    I gave proper URL and user name and password for mysql
    String dsnString="jdbc:mysql://Oracleserver/test";FYI - this will use the default port, I usually explicitly provide it (OracleServer:3306). Why don't you try the URL in the format I gave you above, including the user id and password?
    -Scott

  • Unable to connect the server, while open the rpt file in server from java.

    Hi,
    I have written one java class, that class deployed in solaris server. The BO server is avilable in another solaris server. i want to convert the rpt file to pdf format. for that i try to give the file path to the server for opening the rpt file, that time i got the follwoing error:
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException:
    Unable to connect to the server: uinbrdcsap02. --- Connection refused
    (errno:239)---- Error code:-2147217387 Error code name:connectServer
            at
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException.throwR
    eportSDKServerException(Unknown Source)
            at
    com.crystaldecisions.proxy.remoteagent.TCPIPCommunicationAdapter.connect
    (Unknown Source)
            at com.crystaldecisions.proxy.remoteagent.z.a(Unknown Source)
            at
    com.crystaldecisions.sdk.occa.report.application.ReportAppSession.int(Un
    known Source)
            at
    com.crystaldecisions.sdk.occa.report.application.ReportAppSession.initia
    lize(Unknown Source)
    *My java code is the following ..*
    package com.ramco.report;
    //Crystal Java Reporting Component (JRC) imports.     
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.ByteArrayInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.ByteArrayOutputStream;
    import java.sql.Connection;
    import java.sql.CallableStatement;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.text.SimpleDateFormat;
    import com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat;
    import com.crystaldecisions.sdk.occa.report.exportoptions.ExportOptions;
    import java.util.Calendar;
    import java.util.Properties;
    import org.apache.log4j.Logger;
    import org.apache.log4j.SimpleLayout;
    import org.apache.log4j.FileAppender;
    import java.net.InetAddress;
    import java.net.UnknownHostException;
    // Class file starting.
    public class StandardReconReport
         private Connection objConnection = null;
         private DBConnection dbconnection = null;
         private ByteArrayInputStream byteArrayInputStream =null;
         private FileOutputStream fileOutputStream = null;     
         private ByteArrayOutputStream byteArrayOutputStream = null;
         private CallableStatement callablestatement = null;
         private CallableStatement callablestatement1 = null;     
         private ResultSet resultset1 = null;
         private ResultSet resultset = null;
         private String Deal_No = null;
         private String Job_Date = null;     
         private String Reportservername = null;
         private SimpleLayout layout   = null;
         private FileAppender appender = null;
         private Logger logger            = null;
         private String     DateTimeFormat = null;
         private String Report_File_path =null;
         private String Pdf_File_Name = null;     
         private Properties properties = null;
         private String LogFilePath = null;
         private String FileName = null;
         private String FullLogFilePath = null;
         private Statement statement = null;
         private String Report_upload_path = null;
         private String StanReconDir = null;
         private String winandsol = null;
         private com.crystaldecisions.sdk.occa.report.application.ReportClientDocument  reportClientDoc = null;
         private int count_tmp=0;
         private String DATE_FORMAT = null;
         private String dateformat = null;
         private Calendar cal = null;
        private SimpleDateFormat sdf = null;
        private String reconfilename = null;    
         // Method for Generating Report.....
         private void stanReportGeneration()
              try
                   properties = new Properties();
                   properties.clear();
                 properties.load(new FileInputStream("GeneralInfo.properties"));
                 Reportservername = properties.getProperty("reportservername");
                 reconfilename = properties.getProperty("reconfilename");
                 layout = new SimpleLayout();
                   LogFilePath = properties.getProperty("logfilepath");               
                   dateformat = dateTime1(properties.getProperty("dateformat1"));
                   StanReconDir = properties.getProperty("stanrecondir");
                  winandsol = properties.getProperty("windowsandsolaris");        
                  if (new File(LogFilePath).exists())
                       LogFilePath = LogFilePathdateformatwinandsol;
                       if (new File(LogFilePath).exists())
                       else
                            new File(LogFilePath).mkdirs();
                  FileName = "STANRECONLOGFILE-";             
                  FileName = FileNamedateformat".txt";             
                  FullLogFilePath = LogFilePath+FileName;
                  appender = new FileAppender(layout,FullLogFilePath,false);
                 logger = Logger.getLogger("MyLogger");
                 logger.addAppender(appender);
                 DateTimeFormat = properties.getProperty("datetimeformat");       
                 logger.info("The Start Recon Report Start Time: " +dateTime(DateTimeFormat));             
                 logger.info("");            
                 try
                      InetAddress address[] = InetAddress.getAllByName(Reportservername);                 
                     for (int i=0; i<address.length;i++)
                          logger.info("Report Server Name: " + address<i>.getHostName());
                          logger.info("Report Server Address: " + address<i>.getHostAddress());
                          logger.info("Report Server Canonical: " + address<i>.getCanonicalHostName());
                 catch (UnknownHostException e)
                      logger.error("The host "Reportservername"is not avilable");
                 Report_File_path = properties.getProperty("StandardReconReportpath");          
                  logger.info("The Report File Name is : "+Report_File_path " - "dateTime(DateTimeFormat));
                  //Report_File_path="rassdk://"+Report_File_path;
                  try
                       //Getting the Database connection....
                       dbconnection = new DBConnection();
                      objConnection = dbconnection.getConnections();
                      statement = objConnection.createStatement();
                      String sqlQuery = "SELECT TRIM(PARAM_VALUE) FROM SYS_USER_PARAM WHERE COMPONENT = 'REPORT' AND LINE_NO = 1 AND PARAM_NAME = 'REPORT_DOWNLOADPATH' AND STATUS = 'A'";
                      resultset = statement.executeQuery(sqlQuery);
                      while(resultset.next())
                           Report_upload_path = resultset.getString(1);
                           logger.info("Report_upload_path from the DB: "+Report_upload_path);
                  catch (SQLException ex)
                       ex.printStackTrace();
                       System.out.println(ex);
                       logger.error(ex);
                  catch(Exception ex)
                       ex.printStackTrace();
                       System.out.println(ex);
                       logger.error(ex);
                  finally
                       if(statement!=null)
                            statement.close();
                       if(resultset!=null)
                            resultset.close();
                  if (new File(Report_upload_path).exists())
                       Report_upload_path = Report_upload_path+StanReconDir;
                       if (new File(Report_upload_path).exists())
                            System.out.println("Directory is avilable"+Report_upload_path);
                       else
                            new File(Report_upload_path).mkdirs();
                  Report_upload_path = Report_upload_pathwinandsoldateformat+winandsol;              
                  if (new File(Report_upload_path).exists())
                  else
                       new File(Report_upload_path).mkdirs();
                  logger.info("Report_upload_path : "Report_upload_path" : "+dateTime(DateTimeFormat));
                  try
                       logger.info("Calling the REPORT_STAN_RECON_CON SP : "+dateTime(DateTimeFormat));
                      callablestatement = objConnection.prepareCall("{call REPORT_STAN_RECON_CON(?)}");
                      callablestatement.registerOutParameter(1, oracle.jdbc.driver.OracleTypes.CURSOR);
                        callablestatement.execute();
                        resultset=(ResultSet)callablestatement.getObject(1);
                        if(resultset!=null)
                             while(resultset.next())
                                  count_tmp = count_tmp+1;
                                  logger.info("");                              
                                 Deal_No   = resultset.getString(1);
                                  Job_Date = resultset.getString(2);
                                  DATE_FORMAT = resultset.getString(3);
                                  Job_Date = Job_Date.substring(0,10);
                                  logger.info("*********** PDF Convertion Starting for a Deal No: " +Deal_No " :: "dateTime(DateTimeFormat));
                                  Pdf_File_Name = Report_upload_pathreconfilenameDeal_No"-"DATE_FORMAT+".pdf";                              
                                  Job_Date = Job_Date.replace('-', '/');
                                  logger.info("The Deal_No is : "+Deal_No " - "dateTime(DateTimeFormat));
                                  logger.info("The Job_Date is : "+Job_Date " - "dateTime(DateTimeFormat));
                                  try
                                     reportClientDoc = new com.crystaldecisions.sdk.occa.report.application.ReportClientDocument();
                                       reportClientDoc.setReportAppServer(Reportservername);                                   
                                       logger.info("Report App server Name := "+ reportClientDoc.getReportAppServer());
                                       logger.info("Report_File_path  := "+ Report_File_path);                             
                                       reportClientDoc.preCreateServerAgent(true);                            
                                       reportClientDoc.open(Report_File_path,0);                         
                                       logger.info("After opening the RTF file for : "+Deal_No " Deal_No - "dateTime(DateTimeFormat));
                                                 callablestatement1 = objConnection.prepareCall("{call REPORT_STANDARD_RECON(?,?,?,?)}");
                                       callablestatement1.setString(1, Job_Date);
                                       callablestatement1.setString(2, Deal_No);
                                       callablestatement1.setString(3,"");
                                       callablestatement1.registerOutParameter(4, oracle.jdbc.driver.OracleTypes.CURSOR);
                                       callablestatement1.execute();
                                       resultset1=(ResultSet)callablestatement1.getObject(4);
                                       String tableAlias = reportClientDoc.getDatabaseController().getDatabase().getTables().getTable(0).getAlias();
                                       reportClientDoc.refreshReportDocument();
                                       reportClientDoc.getDatabaseController().setDataSource(resultset1, tableAlias , "Result Set");
                                       reportClientDoc.refreshReportDocument();                         
                                       ExportOptions oExportOptions = new ExportOptions();
                                       oExportOptions.setExportFormatType(ReportExportFormat.RTF);
                                       byteArrayInputStream = (ByteArrayInputStream)reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
                                       logger.info("After exporting the report file to PDF file for the : "+Deal_No " Deal_No - "dateTime(DateTimeFormat));
                                       //Use the Java I/O libraries to write the exported content to the file system.
                                       byte byteArray[] = new byte[byteArrayInputStream.available()];     
                                       //Create a new file that will contain the exported result.
                                       logger.info("Successfully exported report to " + Report_File_path" - "dateTime(DateTimeFormat));
                                       logger.info("*********** PDF Convertion Ending for a Deal : "Deal_No" "+dateTime(DateTimeFormat));
                                       logger.info("");
                                       Deal_No   = null;
                                       Job_Date  = null;
                                  catch (SQLException ex)
                                      ex.printStackTrace();
                                      System.out.println(ex);
                                      logger.error(ex);
                                  catch (IOException ex)
                                      ex.printStackTrace();
                                      System.out.println(ex);
                                      logger.error(ex);
                                  catch (Exception ex)
                                       ex.printStackTrace();
                                      System.out.println(ex);
                                      logger.error(ex);
                                  finally
                                       if(byteArrayInputStream!=null)
                                            byteArrayInputStream.close();
                                       if(byteArrayOutputStream!=null)
                                            byteArrayOutputStream.close();
                                       if(fileOutputStream!=null)
                                            fileOutputStream.close();
                                       if(callablestatement1!=null)
                                            callablestatement1.close();
                                       if(resultset1!=null)
                                            resultset1.close();
                                       if(reportClientDoc!=null)
                                            reportClientDoc.close();
                        if(count_tmp==0)
                             logger.info("");
                             logger.info(" $$$$$$$$ There is NO DATA for generating the Report $$$$$$$: " +dateTime(DateTimeFormat));
                  catch (SQLException ex)
                       ex.printStackTrace();
                       System.out.println(ex);
                       logger.error(ex);
                  catch (Exception ex)
                        ex.printStackTrace();
                       System.out.println(ex);
                       logger.error(ex);
                  finally
                       if(callablestatement!=null)
                            callablestatement.close();
                       if(resultset!=null)
                            resultset.close();
                       if(objConnection!=null)
                            objConnection.close();
                       if(callablestatement1!=null)
                            callablestatement1.close();
                       if(resultset1!=null)
                            resultset1.close();
              catch (IOException ex)
                  ex.printStackTrace();
                  System.out.println(ex);
                  logger.error(ex);
              catch (Exception ex)
                   ex.printStackTrace();
                  System.out.println(ex);
                  logger.error(ex);
              finally
                  properties.clear();              
              logger.info("");
              logger.info("*******Standard Recon Report End Time*******: "+dateTime(DateTimeFormat));
         // Getting the current date and time..
         public String dateTime(String dateFormat)
              cal = Calendar.getInstance();
             sdf = new SimpleDateFormat(dateFormat);
             return sdf.format(cal.getTime());
         //Getting the Yesterday Date and time...
         public String dateTime1(String dateFormat)
              cal = Calendar.getInstance();
              cal.add(Calendar.DATE, -1);            
             sdf = new SimpleDateFormat(dateFormat);
             return sdf.format(cal.getTime());
         public static void main(String[] args) {
              StandardReconReport  SR = new StandardReconReport();
              SR.stanReportGeneration();
    For the above code  i given the report parameter from  the property file.
    reportservername=servername
    datagenreportpath=rassdk\://C\:
    MyEclipseWorkPlace
    IDSREPORTGENERATION
    REPORTFILES
    STANDARD_RECON_REPORT.rpt
    The code is working fin, while i try to connect the BO which is avilble in Windows server, but this is not working if the BO is avilble in solaris server.
    Any bodies please help
    Edited by: velmurugan.spn on Sep 12, 2009 6:38 AM

    Hi,
    Not able to find Report - Standard templates or Report - Custom templates view in Administration - BIP reports in Siebel 8.1.1.3?
    We have applied 8.1.1.3 patch on 8.1.1.0
    below are the steps followed
    Reports are not generated after 8.1.1.3 patch installtion.
    we have also followed to below steps mentioned for this issue in oracle support.
    "In order to resolve this behavior it is necessary to ensure that the 8.1.1.3 FixPack has been applied to the Siebel Tools installation. This will provide an additional .zip file in the REPPATCH folder of the Siebel Tools installation. Once this has been done please then follow the configuration steps as documented :
    change sysprefix to X_ before sif import and chage back to SBL_ after sif import.
    1) Import the sif files from Siebel\8.1\Tools_1\REPPATCH\12-1VMBCSV.zip
    2) Import the 4 SIF files in the following order:
    S_XMLP_REP_TMPL_02112010.sif
    SBL_XMLP_REPORT_SELECTION_FLG.sif
    Report Template BC.sif
    Report Template Registration Applet.sif
    3)Apply the DDL for table S_XMLP_REP_TMPL and compile repository
    Once the above steps have been completed the Selected Record flag will appear in the Report Template Registration views."
    we still not able to generated able to generate reports even after following above steps.
    Thanks
    Sean

  • Unable to connect to MySQL Database using MX

    I am unable to connect to MySQL database hosted on a remote
    server. I get the following error message:
    "HTTP Error Code 404 File Not Found. Here are some possible
    reason for the problem:
    1) There is no testing server running on the server machine.
    2) The testing server specified for this site does not map to
    the
    http://72.9.255.2/~keyitems/_mmServerScripts/MMHTTPDB.php
    URL. Verify that the URL Prefix maps to the root of the site."
    I have specified a testing server. My url is "
    http://72.9.255.2/~keyitems/........."
    For the URL prefix to the site's root folder, I listed the
    following:
    1.
    http://72.9.255.2/~keyitems/
    this did not work. I got the above error message.
    2.
    http://72.9.255.2/ this did not work
    also. I got the above error message.
    Any input would be great as I do not know where to start !!!
    Thank you

    Hi Ravi
    Glad to hear you solved this. It is very gratifying when one solves it alone, don't you think?
    Best wishes
    Michael

  • Few question about Java and MySQL connection

    Hi!
    I have some problems with creating connection between Java and MySQL.
    I followed the restrictions in mysql-connector-java.jar' readme, I set the CLASSPATH :
    CLASSPATH=.;D:/mysql/mysql-connector-java.jar;
    I copied this jar file to the right place (descripted above), and I used the right steps to load it:
    Class.forName('com.mysql.jdbc.Driver"); and it throws a ClassNotFoundException
    Why? All the paths are correct, everything is on the right place.... I dont know why.
    When I installed the JBuilder8, and copied the jar file to JBuilder8/jdk4/jre/lib/ext it worked without any CLASSPATH in enviromental variables.
    If I want to run my program on machines where are not JBuilder, what should I do?
    Please help, if you can.
    Thanks,
    henpanta

    Yeah. So if I compiled my program with JBuilder to an .exe file, I cant run it on other machines, if the jar file isnt in the same place?
    If I tried your advice, java -classpath mymainclass I got the next message:
    main class not found. Believe me, its there. :(

Maybe you are looking for

  • Managed Attachments - I/PM is not working when called from EBS

    Hi. When we click on "Managed Attachments" I/PM login screen should be populated. It was working fine before... Today, it is not working as expected. The following exception is coming in I/PM console logs... *<Dec 18, 2011 5:00:23 PM GMT+04:00> <Erro

  • IPhone 6 is not recognized by iTunes 11.?

    Just got my 6 in the mail. Tried to set up via iTunes backup, but when I connected via USB, it never shows up in the Devices pane. My old 4s shows up no problem, and I JUST upgraded iTunes today, so I don't understand what's going on. Any thoughts?

  • Install old software package

    Hi, I try to install LAPP (Apache Postgres PHP) on ArchLinux for use mysource_martrix CMS. All work fine but mysource_matrix work only with PHP 5.2.x. The last package of PHP in ArchLinux is 5.3.2. It is possible to install an old package in ArchLinu

  • OS X Server 10.9.x Client will not bind to LDAP/OD Server 10.9.x

    I've done multiple server updates, installs etc. with no luck. I cannot get OS X Maverick 10.9.x clients to bind to a OS X Server Maverick 10.9.x Open Directory LDAP. I've tried clients & server installs of 10.9.1 , .2, & .3 with no luck. When I go t

  • Photos are blurry after upgrade to 9.4.2.,

    I recently installed the latest iPhoto upgrade and the quality of my photos is considerably worse. They are blurry or fuzzy around the edges - didn't used to be the case. Is there a way I can fix this? Thanks!