Cannot connect to MySql

Hi,
through an ESB-Project I watn to connect to a MySql DB. I am using the DB-Adapter in JDeveloper. I already configured the DB connection in JDeveloper and I am able to explore the DB there. But when I deploy the project to SOA Suite 10g nothing is inserted into the MySql DB. I think I have to add a DataConnection for the DB. But it does not work. I did the following steps:
1. I copied the MySql JDBC Driver to %ORAHOME%\j2ee\home\applib
2. added <library path="../../home/applib/mysql-connector-java-5.1.6-bin.jar"/> to application.xml in %ORAHOME%\j2ee\home\config
3. tried to add Datasource under JDBC-Ressources under my OC4J Instance with the following parameters:
Name: MySqlDB
JNDI: jdbc/MySql
Class: com.mysql.jdbc.Driver
JDBC URL: jdbc:mysql://localhost:3306/esb (the schema is present and the DB is running)
User: "myUser"
PW: "MyPW"
When I click next or test connection I got the following error where it says that a class is missing (com.mysql.jdbc.Driver) but that the missing class is available under ../../home/applib/mysql-connector-java-5.1.6-bin.jar:
Unable to create: com.mysql.jdbc.Driver
Fehlende Klasse: com.mysql.jdbc.Driver Abhängige Klasse: oracle.oc4j.sql.config.DataSourceConfigUtils Loader: oc4j:10.1.3 Code-Source: /C:/Oracle/OracleAS/j2ee/home/lib/oc4j-internal.jar Konfiguration: in META-INF/boot.xml in C:\Oracle\OracleAS\j2ee\home\oc4j.jar Diese Load wurde um ascontrol.web.ascontrol:0.0.0 mit der Methode Class.forName() eingeleitet. Die fehlende Klasse ist in den folgenden Speicherorten verfügbar: 1. Code-Source: /C:/Oracle/OracleAS/j2ee/home/applib/mysql-connector-java-5.1.6-bin.jar (from in /C:/Oracle/OracleAS/j2ee/home/config/server.xml) Diese Code-Source ist im Loader global.libraries:1.0 verfügbar. Diese Shared Library kann von der Anwendung "ascontrol" importiert werden.
What should I do to get this working?

Which of the logs do you mean? I havent found anything related to the JDBC-Connector in the log files. After a restart I am still not able to create the data source.
Do I have to create a Connection Factory and a connection pool? Dont know how to solve this.

Similar Messages

  • Connection to db rejected.Cannot connect to MySQL server

    here is the excaption
    connectToDb:02 - connection to db rejected.Cannot connect to MySQL server on localhost:3306. Is there a MySQL server running on the machine/port you are trying to connect to? (java.net.BindException)
    and her is the class
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    public class DBconnect
    {  final static private String _url        = "jdbc:mysql://localhost:3306/diamonds";     //final static private String _driver     = "sun.jdbc.odbc.JdbcOdbcDriver";
        //final static private String _url        = "jdbc:odbc:diamonds";     //final static private String _driver     = "sun.jdbc.odbc.JdbcOdbcDriver";
        public Connection     _con                     = null;
         //private static Driver          driver          = null;
         private static Properties     properties     = null;
         Statement stmt                                 = null;
         public PrintStream     out;
            **connectToDb **
            public void connectToDb()        throws IOException
            //connect to the server and open the database
             try{
                   Class.forName("org.gjt.mm.mysql.Driver");
                   //Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   //driver = (Driver)Class.forName (_driver).newInstance();
                   properties = new Properties();
                properties.put("user","sa");
                   properties.put("password","");
            catch (ClassNotFoundException e)
                   System.out.println("class not found:");
                   e.printStackTrace();
              catch (Exception e) {
                        e.printStackTrace();
                 throw new IOException("connectToDb:01- JDBC driver not found."+e.getMessage());
         synchronized void open()throws Exception
              try
                   if(_con == null)
                        try
                             _con = DriverManager.getConnection(_url,properties);
                             //_con = driver.connect(_url,properties);
                        catch (SQLException e)
                             e.printStackTrace();
                             System.out.println("connectToDb:02 - connection to db rejected."+e.getMessage());
                        stmt = _con.createStatement();
              catch (Exception e)
                   e.printStackTrace();
                   System.out.println("connectToDb:02 - connection to db rejected."+e.getMessage());
         synchronized void close()
              try
                   if(_con != null)
                        if(!_con.isClosed())
                             stmt.close();
                             _con.close();
                             _con = null;
              catch (Exception e)
                   System.out.println("es:fail to close connection!!");
    }the problem occars when there are a lot of queries that the project is sending to the DB (about 10000) the last half queries fails and send an excaption .
    after 2 minutes the system seems like working fine.
    I am stack with this problem about a year and cann't resolve it.
    any idea????
    regards
    amnon m

    well...new it seems to work fine, but is it ok to
    keep connection open for good ???
    isn't there any other alternative ???I am bit confused are you pooling the connections?
    If so, actually the connections will not always stay open.. they will time out after a while when they are not in use but to specifically answer your question.. how could it possible be a bad thing. If the server/your app was getting bogged down with opening and closing connections then pooling solves this..
    Finally as to your question of the alternatives... if the problem was opening and closing connections and reusing them through a pool solved this then I think the answer is no. If you don't like a specific part of the way the pool works it is probably configurable in some way and you could always implement your own pool.. although I wouldn't overly recommend that. The bottom line is that you need to keep your connections open for reuse.. pooling is the simplest way to achieve this.. but no there is no alternative to keeping your connections open if you are having the load problems you described.

  • Why JApplet and JSP cannot connect to MySQL

    When i use applet connect to MySQL, it show that no suitable driver.
    My program is
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import java.sql.*;
    public class fuck extends JApplet implements ActionListener
    private JButton bb = new JButton("update");
    private JTextArea aa = new JTextArea(1,7);
    private JTextArea ss = new JTextArea(1,7);
    private JPanel pp = new JPanel();
    public fuck()
    Container c=getContentPane();
    pp.add(aa);
    pp.add(ss);
    pp.add(bb);
    c.add(pp);
    bb.addActionListener(this);
    public void actionPerformed(ActionEvent ee)
    try
    Class.forName("org.gjt.mm.mysql.Driver");
    catch(ClassNotFoundException e)
    System.out.println(e.getMessage());
    try
    Connection con =
    DriverManager.getConnection("jdbc:mysql://localhost/air","root","");
    Statement st = con.createStatement();
    //PreparedStatement pst = con.prepareStatement(
    // "update aa set condition=? where temp=?");
    //pst.setInt(1,3);
    //pst.setString(2,"hg");
    //pst.executeUpdate();
    ResultSet rs=
    st.executeQuery("select * from aa");
    while (rs.next())
    aa.setText(rs.getString("temp"));
    ss.setText(rs.getString("condition"));
    st.close();
    con.close();
    catch(SQLException ex)
    System.err.println("SQLException:"+ex.getMessage());
    If I using JSP, it also have some condition

    Clearly it is in the classpath, otherwise the error would have been "Class not found". But here's a quote from the documentation for the driver, the part that explains how to make a connection:// The newInstance() call is a work around for some
    // broken Java implementations
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();The "broken Java implementations" it refers to are certain JVMs that run applets in browsers...

  • Dreamweaver 8 Error: Cannot connect to mySQL

    I am trying to access my database in Dreamweaver 8, I get an
    error message 'An ftp error occurred, cannot make connections to
    host. The remote host cannot be found’
    The following is what I have been doing on the wizard in
    Dreamweaver 8 for Site Defination for Test:-
    Step 1
    Name of Site: Test
    HTTP Name of site:
    http://localhost/
    Server Technology : PHP mySQL
    Step 2
    How do you connect to your testing server: FTP
    What is the hostname or FTP address of your webserver:
    http://localhost
    (I have also tried localhost,
    http://localhost:3360)
    What folder on the testing server do you want your files in:
    TESTING
    What is your ftp login: mylogin
    What is your ftp password: my password
    When I test connection, I get an error ‘An ftp error
    occurred, cannot make connections to host. The remote host cannot
    be found’
    I use Easy PHP with PHP, mySQL and Apache Server on my local
    computer and I can easily access my databse through PHP mySQL

    makiz63 wrote:
    > The following is what I have been doing on the wizard in
    Dreamweaver 8 for
    > Site Defination for Test:-
    The wizard is not the best way to do it. Switch to the
    Advanced tab and
    select Testing Server.
    Server model: PHP MySQL
    Access: Local/Network
    Testing server folder: Wherever the folder is, but it must be
    in the
    Apache DocumentRoot
    URL prefix:
    http://localhost/foldername/
    > I use Easy PHP with PHP, mySQL and Apache Server on my
    local computer and I
    > can easily access my databse through PHP mySQL
    I don't know how EasyPHP sets things up, but you need to find
    out what
    the Apache DocumentRoot is - it's normally a folder that's
    called
    htdocs. Create a subfolder inside htdocs, and put your PHP
    files in
    there. Say you call it "mysite", the URL prefix then becomes
    http://localhost/mysite/.
    David Powers, Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Cannot connect to MySQL database

    Hi
    I'm new to flex builder 3... and have therefore looked at
    lynda.com to learn about the product and get started fast. And here
    they show you how to create a connection to a MySQL database using
    MAMP on a mac (or WAMP on the PC) - I'm on the mac ;-).
    I have installed the MAMP server with both MySQL, Apache and
    PHP running on defalt ports. And I have created a simple database
    in MySQL... The site is running fine and so is the MySQL (I have
    tested with simple HTML etc)... but when I try to connect to the
    database using the wizard in Flex, I get the following message:
    Unable to connect to the database....
    If I look at the details it say (hold on):
    com.mysql.jdbc.CommunicationsException: Communications link
    failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.net.NoRouteToHostException: No route to host
    STACKTRACE:
    java.net.SocketException: java.net.NoRouteToHostException: No
    route to host
    at
    com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
    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
    org.eclipse.datatools.connectivity.db.generic.JDBCConnection.createConnection(JDBCConnect ion.java:87)
    at
    org.eclipse.datatools.connectivity.DriverConnectionBase.internalCreateConnection(DriverCo nnectionBase.java:104)
    at
    org.eclipse.datatools.connectivity.DriverConnectionBase.open(DriverConnectionBase.java:53 )
    at
    org.eclipse.datatools.connectivity.db.generic.JDBCConnectionFactory.createConnection(JDBC ConnectionFactory.java:52)
    at
    org.eclipse.datatools.connectivity.internal.ConnectionFactoryProvider.createConnection(Co nnectionFactoryProvider.java:77)
    at
    org.eclipse.datatools.connectivity.internal.ConnectionProfile.createConnection(Connection Profile.java:354)
    at
    com.adobe.datatools.derived.wizards.BaseConnectionProfilePage.testConnectionSimple(BaseCo nnectionProfilePage.java:70)
    at
    com.adobe.datatools.derived.wizards.BaseConnectionProfilePage.testConnection(BaseConnecti onProfilePage.java:51)
    at
    org.eclipse.datatools.connectivity.ui.wizards.ConnectionProfileDetailsPage$1.widgetSelect ed(ConnectionProfileDetailsPage.java:85)
    at
    org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
    at
    org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at
    org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1495)
    at
    org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1519)
    at
    org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1504)
    at
    org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1295)
    at
    org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3350)
    at
    org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2954)
    at
    org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
    at org.eclipse.jface.window.Window.open(Window.java:796)
    at
    com.adobe.flexbuilder.dbwizard.ui.DbWizard$8.widgetSelected(DbWizard.java:598)
    at
    org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)
    at
    org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at
    org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1495)
    at
    org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1519)
    at
    org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1504)
    at
    org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1295)
    at
    org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3350)
    at
    org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2954)
    at
    org.eclipse.jface.window.Window.runEventLoop(Window.java:820)
    at org.eclipse.jface.window.Window.open(Window.java:796)
    at
    com.adobe.flexbuilder.dbwizard.actions.DBWizardAction.run(DBWizardAction.java:69)
    at
    org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:256)
    at
    org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229)
    at
    org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionI tem.java:546)
    at
    org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)
    at
    org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java :402)
    at
    org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
    at
    org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1495)
    at
    org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1519)
    at
    org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1504)
    at
    org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1295)
    at
    org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3350)
    at
    org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2954)
    at
    org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)
    at
    org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)
    at
    org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)
    at
    org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)
    at
    org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)
    at
    org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)
    at
    org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
    at
    com.adobe.flexbuilder.standalone.FlexBuilderApplication.start(FlexBuilderApplication.java :112)
    at
    org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)
    at
    org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLau ncher.java:106)
    at
    org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.jav a:76)
    at
    org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)
    at
    org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
    Method)
    at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at
    org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:508)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1173)
    ** END NESTED EXCEPTION **
    .... and more ...
    What the h.. does that mean - Plz advice someoone ... I'm
    really stock here ;-(
    Kind regards
    Brian

    Thanks for the answer, but I must be doing something very
    wrong - as I still havn't found the correct solution ;-(
    I have as mentioned tried both the default MySQL port (3306)
    and the one used by MAMP (8889) but without any luck.
    I do restart the MySQL server each time - and MAMP even does
    that by default when changing the port number.
    If I open myphpadmin the DB is running and as told I can
    connect to it using Dreamwaever...
    But If I run the command "telnet localhost 8889" you told my
    to, in terminal I get the following message:
    Trying ::1...
    telnet: connect to address ::1: Connection refused
    Trying fe80::1...
    telnet: connect to address fe80::1: Connection refused
    Trying 127.0.0.1...
    telnet: connect to address 127.0.0.1: Connection refused
    telnet: Unable to connect to remote host
    So here it looks as if I can't connect ??? The same happens
    if I try the default port 3306.
    Everytime I test in the wizard I get the message:
    com.mysql.jdbc.CommunicationsException: Communications link
    failure due to underlying exception:
    ** BEGIN NESTED EXCEPTION **
    java.net.SocketException
    MESSAGE: java.net.NoRouteToHostException: No route to host
    STACKTRACE:
    java.net.SocketException: java.net.NoRouteToHostException: No
    route to host
    at
    com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:....
    etc
    And yes it is the Data -> Create Application from Database
    wizard that I'm trying to use.
    I don't undersatnd why the lynda.com video tell that it is
    important to change the MAMP's settings to the default port instead
    of using the MAMP ports, when you say it is not like that ? They
    even show how to disable the default Apache webserver to use the
    MAMP one on port 80.
    Hope the terminal message can give someone a hint to the
    posible problem.
    Thanks in advance

  • Cannot connect to mysql server

    [530211450FCD7FAD57BCBD082C766733] [ERR] Errore JDBC:java.lang.NoClassDefFoundError: java/sql/SQLClientInfoException.
    Even i already set mysql-connector-java-5.1.3-rc-bin in JDK1.5\lib\ext folder.

    SQLClientInfoException is a rather new class that was added only in Java 6.
    It seems that this version of the MySQL JDBC driver requires Java 6.

  • How can I connect to MySQL external database

    Hello.
    I have a SAP system running in SQL Server 2003.
    I need to connect to external MySQL DB., to operate with this information in ABAP program.
    I have done the step necesary... I mean I go to DBCO transaction and configure the connection like this:
    DB CONNECTION --> AFIS
    DBMS --> MSS
    user name --> xxxxxx
    DBpass -->xxxxxx / xxxxxx
    Conn Info -->MSSQL_SERVER=192.168.1.233 MSSQL_DBNAME=alliance OBJECT_SOURCE=alliance
    I do a test program, when I do the statement CONNECT TO, sy-subrc 0 and connection = DEFAULT... I mean, with this form I cannot connect to MySQL Database...
    Can you help me to do this?? I think the problem it's the connection string in DBCO... but I'm not sure...,
    Would be possible to connect by MySQL ODBC??? I mean , installing the ODBC driver in my SAP server, and using this in ABAP Program??
    Thks.
    DATA: BEGIN OF wa,
    cod_modelo(20),
    END OF wa.
    DATA: dbs TYPE dbcon-con_name.
    DATA: con(20) TYPE c.
    DATA : ls_wa LIKE wa.
    con = 'AFIS'. "DB Connection in DBCO above
    EXEC SQL.
    CONNECT TO :con
    ENDEXEC.
    WRITE sy-subrc. ---> The result it's 4
    EXEC SQL.
    GET CONNECTION :con
    ENDEXEC.
    WRITE : con. --> The result it's DEFAULT
    EXEC SQL.
    SET CONNECTION DEFAULT
    ENDEXEC.
    write : con. --> The result it's DEFAULT

    > It's for it, that when I go to DBCO... in DBMS ---... I can select Oracle, MSSQLServer, DB2... for this Databases..., exists the library (lib_dbsl)???
    yes, for all those databases exists the database interface library.
    > In resume:
    >  IT'S NOT POSSIBLE CONNECT TO MYSQL!!! ... I cannot believe it!!!...
    Well - as far as I remember there were some times ago efforts to port SAP applications to MySQL. That would explain why there's also a file "DDLMYS.TPL" created if you execute R3ldctl during a system copy - amongst DDL files for all other databases. I believe this was at the time MySQL was promoting SAPDB/MaxDB.
    MySQL is historically not a database engine for software, that requires transactional integrity; there were extensions to support that (InnoDB or others) and there was no customer demand in getting MySQL as engine for SAP applications. And only develop an interface to be able to connect to an external MySQL engine is not worth the effort.
    However, there is hope Some BusinessObjects applications also run with and against MySQL engines, depending on how the strategy to integrate those into the SAP software stack there may (or may not) be an interface for that database in the future.
    Markus

  • Connecting to MySQL via DW after Leopard install

    I cannot connect to MySQL 5.041 through DW CS3 after
    upgrading to Leopard. MySQL Admin and MySQL Query Browser both can
    connect and make queries to the database. I just can't connect
    through Dreamweaver. I get the "MySQL Error#: 2002" error which
    states "Can't connect to local MySQL server through socket
    '/var/mysql/mysql.sock' (2). Problem is there is no such
    path.

    There may be an updated needed for dreamweaver, however, I
    did find some info about MySQL running on Leopard:
    http://bugs.mysql.com/bug.php?id=32019
    and some workarounds that I have not tested as being valid:
    http://angry-fly.com/index.cfm/2007/10/26/Fix-for-MySQL-on-Leopard

  • Need help on remote connection to mysql

    Hi all,
    I am trying to make a remote JDBC connection from a servlet running on one linux server to mySql running on another Linux Server.
    I get the following error :
    java.sql.SQLException: Cannot connect to MySQL server on <Linux_server2_IP>:3306. Is there a MySQL server running on the machine/port you are trying to connect to? (java.net.ConnectException)
    I did the following on mySql on Linux-2 :-
    GRANT ALL PRIVILEGES TO myuser@<myLinux-1-IP> IDENTIFIED BY 'pwd' WITH GRANT OPTION;
    I checked the user table and it had an entry for 'myuser' with my myLinux1-IP. The entry had 'N' for all the priv fields.
    I manually updated the priv fields to 'Y' and did :
    FLUSH PRIVILEGES;
    I also added an entry to host table to see if that helped.
    I restarted my mySqld.
    None of these worked !
    I'd really appretiate your help...
    Thanks,
    Spotty8A.

    It doesn't sound like a user privilege problem... that will generally give you a USER_AUTHENTICATION_FAILED error or something along those lines. It seems more like the driver can't detect a MySQL server on the IP/port you're specifying.
    Assuming you didn't change the default port to anything different, the most likely source of the problem is your connection URL... you might double check that the IP you specified is correct.

  • Cannot connect from dreamweaver cs5.5 to mysql using the mysql connection wizard

    Cannot connect from dreamweaver cs5.5 to mysql using the mysql connection wizard error Http error 403 or 500 internal server error. I am using ubuntu mysql.
    a manual php script work fine
    <?php
    // open connection to mysql server
    $dbc = mysql_connect('localhost','root','password');
    if (!$dbc) {
                die('Not Connected' . mysql_error ());
    //select database
    $db_selected = mysql_select_db ("msinventory",$dbc);
    if (!$db_selected)
            die('Cannot Connect' . mysql_error());
    echo "TEST DONE1";
    ?>
    but the database connection wizard fails with http error 403 or 500
    i also use the HeidiSQL client and it works, the only problem is in dreamweaver.

    OK.  Did you really mean to ask this question on a ColdFusion forum, if it's DreamWeaver you're having problems with?  You're probably better off raising this on a DreamWeaver forum.  "Using the correct tool for the job" 'n'all.
    Adam

  • 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.
    %

  • 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.

  • Connecting to MySQL from Sun One Studio

    Hi,
    I am trying to connect to the MySQL from the Sun One Studio 5. I followed these steps.
    1. I downloaded the MySQL software and installed on my local computer, it was successful.
    2. I got the drivers [b][b][b]mysql-connector-java-3.0.8-stable-bin.jar and placed it in the <stdudio5>/lib/ext/ directory.
    3. And I successfully got through that one also, and in the database section it showed me the icon for connecting to mysql database. I gave the url, username, and password. It worked fine.
    4. Then I created the connection pool, JDBC resource, and Persistence manager for my server instance. It was also successful.
    5. When I built a cmp bean accessing the table in mySQL database, it is giving me these errors.
    If you notice these error, it is asking for vendor type. But i don't have any option to choose the vendor type when i configured the database resources.
    Can soem body suggest some other method and clear this error. I am struggling with this since a week.
    Thank you.
    [[b]09/Oct/2003:11:12:31] WARNING ( 3476): Cannot get database metadata: database product name.
    java.sql.SQLException: com.sun.enterprise.repository.J2EEResourceException
    java.lang.ClassNotFoundException: org.gjt.mm.mysql.jdbc2.optional.MysqlDataSource
    at com.sun.enterprise.resource.SystemJdbcDataSource.internalGetConnection(SystemJdbcDataSource.java:252)
    at com.sun.enterprise.resource.SystemJdbcDataSource.getConnection(SystemJdbcDataSource.java:154)
    at com.sun.jdo.spi.persistence.support.sqlstore.ejb.TransactionHelperImpl.getConnection(TransactionHelperImpl.java:171)
    at com.sun.jdo.spi.persistence.support.sqlstore.ejb.EJBHelper.getConnection(EJBHelper.java:169)
    at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getDBName(SQLPersistenceManagerFactory.java:781)
    at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getFromPool(SQLPersistenceManagerFactory.java:709)
    at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getPersistenceManager(SQLPersistenceManagerFactory.java:598)
    at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:770)
    at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:660)
    at JAdminEntityBeans.JobinfoBean_1956195957_ConcreteImpl.jdoGetPersistenceManager(JobinfoBean_1956195957_ConcreteImpl.java:1479)
    at JAdminEntityBeans.JobinfoBean_1956195957_ConcreteImpl.ejbFindByTitle(JobinfoBean_1956195957_ConcreteImpl.java:541)
    at JAdminEntityBeans.JobinfoBean_1956195957_ConcreteImpl_RemoteHomeImpl.findByTitle(JobinfoBean_1956195957_ConcreteImpl_RemoteHomeImpl.java:175)
    at JAdminEntityBeans._JobinfoHome_Stub.findByTitle(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sun.forte4j.j2ee.ejbtest.webtest.InvocableMethod$MethodIM.invoke(InvocableMethod.java:231)
    at com.sun.forte4j.j2ee.ejbtest.webtest.EjbInvoker.getInvocationResults(EjbInvoker.java:96)
    at com.sun.forte4j.j2ee.ejbtest.webtest.DispatchHelper.getForward(DispatchHelper.java:189)
    at jasper.dispatch_jsp._jspService(_dispatch_jsp.java:136)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:552)
    at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:368)
    at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:287)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
    at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
    at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
    at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)
    [09/Oct/2003:11:12:31] INFO ( 3476): Bean Jobinfo method ejbFindByTitle: problems running JDOQL query.
    com.sun.jdo.api.persistence.support.JDOFatalInternalException: Failed to get the vendor type for the data store.
    NestedException: java.sql.SQLException: com.sun.enterprise.repository.J2EEResourceException
    java.lang.ClassNotFoundException: org.gjt.mm.mysql.jdbc2.optional.MysqlDataSource
    at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getDBName(SQLPersistenceManagerFactory.java:802)
    at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getFromPool(SQLPersistenceManagerFactory.java:709)
    at com.sun.jdo.spi.persistence.support.sqlstore.impl.SQLPersistenceManagerFactory.getPersistenceManager(SQLPersistenceManagerFactory.java:598)
    at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:770)
    at com.sun.jdo.spi.persistence.support.sqlstore.impl.PersistenceManagerFactoryImpl.getPersistenceManager(PersistenceManagerFactoryImpl.java:660)
    at JAdminEntityBeans.JobinfoBean_1956195957_ConcreteImpl.jdoGetPersistenceManager(JobinfoBean_1956195957_ConcreteImpl.java:1479)
    at JAdminEntityBeans.JobinfoBean_1956195957_ConcreteImpl.ejbFindByTitle(JobinfoBean_1956195957_ConcreteImpl.java:541)
    at JAdminEntityBeans.JobinfoBean_1956195957_ConcreteImpl_RemoteHomeImpl.findByTitle(JobinfoBean_1956195957_ConcreteImpl_RemoteHomeImpl.java:175)
    at JAdminEntityBeans._JobinfoHome_Stub.findByTitle(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at com.sun.forte4j.j2ee.ejbtest.webtest.InvocableMethod$MethodIM.invoke(InvocableMethod.java:231)
    at com.sun.forte4j.j2ee.ejbtest.webtest.EjbInvoker.getInvocationResults(EjbInvoker.java:96)
    at com.sun.forte4j.j2ee.ejbtest.webtest.DispatchHelper.getForward(DispatchHelper.java:189)
    at jasper.dispatch_jsp._jspService(_dispatch_jsp.java:136)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.iplanet.ias.web.jsp.JspServlet$JspServletWrapper.service(JspServlet.java:552)
    at com.iplanet.ias.web.jsp.JspServlet.serviceJspFile(JspServlet.java:368)
    at com.iplanet.ias.web.jsp.JspServlet.service(JspServlet.java:287)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:720)
    at org.apache.catalina.core.StandardWrapperValve.access$000(StandardWrapperValve.java:118)
    at org.apache.catalina.core.StandardWrapperValve$1.run(StandardWrapperValve.java:278)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:274)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:203)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:505)
    at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:157)
    at com.iplanet.ias.web.WebContainer.service(WebContainer.java:598)

    The AS7 error suggests that you have not set up the server startup classpath to include the driver jar. The steps to do this are included in the article mentioned in Chris's reply, namely:
    http://developers.sun.com/tools/javatools/tips/tip03-08-22.html
    Note especially the part starting with Step 3 under the section "Enabling the JDBC Driver in the IDE."
    -Jane

  • Problem to connect to mysql from servlet using a javabean

    Hi,
    I'm new here and beginner on java to.
    I have problem to connect to MySql database, by a connection javabean.
    It's the following: a HTML page calls a servlet and this servlet imports the package connection javabean.
    It has no problem when I establish the connection inside the servlet, with all its methods (public and private). But i want to separate the code connection from servlet.
    Detail: there is no problem, using the javabean to connect to MS Access database.
    I put "mysql-connector-java-3.1.12-bin.jar" file inside WEB-INF/lib application and common/lib directories.
    I set the classpath:
    SET CLASSPATH=%CATALINA_HOME%\COMMON\LIB\mysql-connector-java-3.1.12-bin.jar;%CLASSPATH%
    I think that the servlet cannot create an instance of javabean, because passed by catch exception of the servlet init method.
    But I don't know why.
    Please Why?
    Below there are the fragment of errors, servlet code e javabean code.
    Thank you.
    Zovao.
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    java.lang.NullPointerException
    at CadServletFileBeanConexArq.doPost(CadServletFileBeanConexArq.java:47)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
    Note: The line 47 is calling insertIntoDB javabean method.
    ========///////////////===============
    // Here is the servlet CadServletFileBeanConexArq.java
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.sql.*;
    import conJdbc.*;
    public class CadServletFileBeanConexArq extends HttpServlet {
    public ConexPed connect = null;
    private String driver = "com.mysql.jdbc.Driver";
    private String URL = "jdbc:mysql://localhost:3306/cadastro";
    public void init( ServletConfig config )
    throws ServletException
    super.init( config );
    try
    connect = new ConexPed(driver, URL, "monty", "some_pass");
    catch ( Exception e )
    e.printStackTrace();
    connect = null;
    public void doPost( HttpServletRequest req,
    HttpServletResponse res )
    throws ServletException
    boolean success = true;
    String email, nome, sobrenome, produto, valor;
    email = req.getParameter( "Email" );
    nome = req.getParameter( "Nome" );
    sobrenome = req.getParameter( "Sobrenome" );
    produto = req.getParameter( "Produto" );
    valor = req.getParameter( "Valor" );
    res.setContentType( "text/html" );
    if ( email.length() > 0 && nome.length() > 0 && sobrenome.length() > 0 && valor.length() > 0 )
    /* inserting data */
    success = connect.insertIntoDB(
    "'" + email + "','" + nome + "','" + sobrenome + "','" + produto + "'", Double.parseDouble(valor) );
    //closing connection
    public void destroy()
    connect.fecharConexao();
    =============///////////////============
    Here is the JavaBean.
    package conJdbc;
    import java.sql.*;
    public class ConexPed
    public Connection connection;
    public Statement statement;
    public ConexPed (String driver, String urlServidor, String user, String password)
    try
    Class.forName(driver);
    connection = DriverManager.getConnection(urlServidor,user,password);
    catch (ClassNotFoundException ex)
    System.out.println("N�o foi poss�vel encontrar a classe do Driver: " + driver);
    catch (SQLException ex)
    System.out.println("N�o foi poss�vel conectar ao servidor");
    try
    statement = connection.createStatement();
    catch (SQLException ex)
    System.out.println("N�o foi poss�vel criar a statement");
    *Inserting data to database
    public synchronized boolean insertIntoDB( String stringtoinsert, double valor)
    try
    statement.executeUpdate( "INSERT INTO pedido values (" + stringtoinsert + " , " + valor + ");" );
    catch ( Exception e ) {
    System.err.println(
    "ERROR: Problemas ao adicionar nova entrada" );
    e.printStackTrace();
    return false;
    return true;
    * Close statement.
    public void fecharStatement()
    try
    statement.close();
    catch (SQLException ex)
    ex.printStackTrace();
    * close database
    public void fecharConexao()
    try
    connection.close();
    catch (SQLException ex)
    ex.printStackTrace();
    }

    Hi,
    I'm new here and beginner on java to.
    I have problem to connect to MySql database, by a connection javabean.
    It's the following: a HTML page calls a servlet and this servlet imports the package connection javabean.
    It has no problem when I establish the connection inside the servlet, with all its methods (public and private). But i want to separate the code connection from servlet.
    Detail: there is no problem, using the javabean to connect to MS Access database.
    I put "mysql-connector-java-3.1.12-bin.jar" file inside WEB-INF/lib application and common/lib directories.
    I set the classpath:
    SET CLASSPATH=%CATALINA_HOME%\COMMON\LIB\mysql-connector-java-3.1.12-bin.jar;%CLASSPATH%
    I think that the servlet cannot create an instance of javabean, because passed by catch exception of the servlet init method.
    But I don't know why.
    Please Why?
    Below there are the fragment of errors, servlet code e javabean code.
    Thank you.
    Zovao.
    HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    java.lang.NullPointerException
    at CadServletFileBeanConexArq.doPost(CadServletFileBeanConexArq.java:47)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
    Note: The line 47 is calling insertIntoDB javabean method.
    ========///////////////===============
    // Here is the servlet CadServletFileBeanConexArq.java
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.*;
    import java.sql.*;
    import conJdbc.*;
    public class CadServletFileBeanConexArq extends HttpServlet {
    public ConexPed connect = null;
    private String driver = "com.mysql.jdbc.Driver";
    private String URL = "jdbc:mysql://localhost:3306/cadastro";
    public void init( ServletConfig config )
    throws ServletException
    super.init( config );
    try
    connect = new ConexPed(driver, URL, "monty", "some_pass");
    catch ( Exception e )
    e.printStackTrace();
    connect = null;
    public void doPost( HttpServletRequest req,
    HttpServletResponse res )
    throws ServletException
    boolean success = true;
    String email, nome, sobrenome, produto, valor;
    email = req.getParameter( "Email" );
    nome = req.getParameter( "Nome" );
    sobrenome = req.getParameter( "Sobrenome" );
    produto = req.getParameter( "Produto" );
    valor = req.getParameter( "Valor" );
    res.setContentType( "text/html" );
    if ( email.length() > 0 && nome.length() > 0 && sobrenome.length() > 0 && valor.length() > 0 )
    /* inserting data */
    success = connect.insertIntoDB(
    "'" + email + "','" + nome + "','" + sobrenome + "','" + produto + "'", Double.parseDouble(valor) );
    //closing connection
    public void destroy()
    connect.fecharConexao();
    =============///////////////============
    Here is the JavaBean.
    package conJdbc;
    import java.sql.*;
    public class ConexPed
    public Connection connection;
    public Statement statement;
    public ConexPed (String driver, String urlServidor, String user, String password)
    try
    Class.forName(driver);
    connection = DriverManager.getConnection(urlServidor,user,password);
    catch (ClassNotFoundException ex)
    System.out.println("N�o foi poss�vel encontrar a classe do Driver: " + driver);
    catch (SQLException ex)
    System.out.println("N�o foi poss�vel conectar ao servidor");
    try
    statement = connection.createStatement();
    catch (SQLException ex)
    System.out.println("N�o foi poss�vel criar a statement");
    *Inserting data to database
    public synchronized boolean insertIntoDB( String stringtoinsert, double valor)
    try
    statement.executeUpdate( "INSERT INTO pedido values (" + stringtoinsert + " , " + valor + ");" );
    catch ( Exception e ) {
    System.err.println(
    "ERROR: Problemas ao adicionar nova entrada" );
    e.printStackTrace();
    return false;
    return true;
    * Close statement.
    public void fecharStatement()
    try
    statement.close();
    catch (SQLException ex)
    ex.printStackTrace();
    * close database
    public void fecharConexao()
    try
    connection.close();
    catch (SQLException ex)
    ex.printStackTrace();
    }

  • Problem connecting to Mysql using JDBC

    Hi Everyone,
    I am trying to connect Mysql ad java applet and I am using the Mysql jdbc connector.
    I Took the mysql-connector-java-5.0.8-bin.jar file and put that in the library of jdk.
    Now i used the following code to connect to the database using Netbeans.
    package testmysql;
    import java.sql.*;
    public class Main
    public static void main (String[] args)
    Connection conn = null;
    try
    String userName = "root";
    String password = "";
    String url = "jdbc:mysql://localhost/rpms";
    Class.forName ("com.mysql.jdbc.Driver").newInstance ();
    conn = DriverManager.getConnection (url, userName, password);
    System.out.println ("Database connection established");
    catch (Exception e)
    System.err.println ("Cannot connect to database server");
    finally
    if (conn != null)
    try
    conn.close ();
    System.out.println ("Database connection terminated");
    catch (Exception e) { /* ignore close errors */ }
    But it displays Cannot connect to database server
    thoughMysql server is running.
    Can anyone tell me wats the prob in this.
    thanks

    String url = "jdbc:mysql://localhost/rpms";
    Class.forName ("com.mysql.jdbc.Driver").newInstance ();
    Is rpms the MySQL database?
    Is the database on the default port 3306?
    Is the MySQL JDBC JAR file in the classpath of the applet?
    newInstance() is not required to be invoked unless using <= JDK 2.0
    Replace:
    catch (Exception e)
    System.err.println ("Cannot connect to database server");
    with:
    catch (Exception e)
    System.err.println (e.getMessage());
    Edited by: dvohra09 on Apr 10, 2009 10:54 PM
    Edited by: dvohra09 on Apr 10, 2009 10:55 PM
    Edited by: dvohra09 on Apr 10, 2009 10:58 PM

Maybe you are looking for