JSP and MySql Connectivity in Fedora core 4

Dear all,
We are developing software using JSP and MySql on Fedora Core 4 platform and are unable to find the connectivity for JSP and MySql. Can anybody help....

Dear all,
We are developing software using JSP and MySql on Fedora Core 4 platform and are unable to find the connectivity for JSP and MySql. Can anybody help....

Similar Messages

  • PleaseHelp on jsp and Mysql connectivity and a lot of exception errors

    Hi,
    I am Trying to connect a JSP page with Mysql database. I am having a lot of probelms. After having a lot of problems in connecting the JSp with Mysql. Intilally it was giving me the exception error that " NO appropriate driver was found. After modifying the URl it was fine. Now It is giving the Following errors.
    servlet.ServletException: Communication link failure: java.io.IOException, underlying cause: Unexpected end of input stream ** BEGIN NESTED EXCEPTION ** java.io.IOException MESSAGE: Unexpected end of input stream
    In a window before loading the Explorer page it is giving the following error that The port 8081 is already in use and i should expand to other ports. Noraml JSP Files which used to work before are also not working .
    Internal Tomcat JWSDP is alos not working. If i try to start the server it says that port 8081 is already in USe . A java.net.connection exception is also occuring. The normal JSP files are also not working. What is Happening. I am also giving the code i have writted. PLease tellme why so many exception errors are occuring.
    Connection con = DriverManager.getConnection("jdbc:mysql://localhost:8081/mis_project", "root", " ");
    Statement stmt = con.createStatement();
    ResultSet rs = stmt.executeQuery("Select study_semester FROM Semester");
    while(rs.next()) {
    %>
    <option value="<%= rs.getString("Study_Semester") %>">
    </option>
    <% }
    if(rs!=null) rs.close();
    if(stmt!=null) stmt.close();
    if(con!=null) con.close();
    I am trying to connect to Mysql and automatocally populate a field in a Form in later JSp pages i intend to record the data entered in these fields into other tables.

    <%
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/myDB?user=username&password=mypass");
    Statement stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY);
    String cat = "";
              try{
              cat = request.getParameter("category");
              }catch(NullPointerException npe){}
              ResultSet rs = stmt.executeQuery("SELECT id,fullname FROM users WHERE category LIKE '%motor%' AND subcategory like '%"+cat+"%'");
         %>
    This piece gets a category parameter from a form post and uses it to search for a specific category in a database table. I think maybe u need to download JConnector from mysql site and unzip it to the classes folder of your WEB-INF in Tomcat server...... i hope this helps a bit

  • 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

  • PHP and MySQL Connection problem

    I am trying to make a PHP MySQL on a remote server connection in Dreamwesaver CS3.
    When I enter the information (host, user, password, etc.) and hit TEST, I get the following error message.
    "Access Denied. The file may not exist, or there could be a permission problem. Make sure you have proper authorization on the server and the server is properly configured."
    I know the user, password, etc. work, as I can access the MySQL database with other software.
    I checked with my host and they say there are no permission problems on their end.
    I have checked the settings on the Test Server page in Site Setup and everything looks correct and works there.
    I have not seen this particular problem described in other forum postings (although there are a LOT of postings on this topic!).
    Any help would be appreciated.

    I thought my testing server was the remote server and is always on as far as I know. I don't know how to turn it on or off.
    Is there some other testing server that I should be aware of?
    Frank
    Date: Wed, 3 Jun 2009 15:43:02 -0600
    From: [email protected]
    To: [email protected]
    Subject: PHP and MySQL Connection problem
    I know you are using remote, but is your testing server on? if not turn that on and see if that does it. it just happened to me working on remote server and could not get mysql conn to work, until I turn on my testing (developer server), then I was able to connect to mysql and the tables that I created in phpmyadmin remotly was downloaded.
    >

  • Weblogic8.1 and mysql connection failure, please help

    Pardon me for repeating this topic. I have spent 2 days on this but still ended
    up with failure.
    The similar configuration works very well under wls7.0.
    It should not be a problem of jdbc driver or its classpath setting, since the
    system console say "successful..."
    But when I try to access jsp and servlets, it always throws execeptions. All projects
    run successfully under wls7.0 don't work.
    Please give me some advice, thanks in advance.
    The following is my connection pool setting found in config.xml:
    <JDBCConnectionPool DriverName="com.mysql.jdbc.Driver"
    Name="MySQLConnectionPool" Password="{3DES}aMsyd4ZSbSg="
    Properties="user=root" Targets="cgServer" URL="jdbc:mysql://localhost/userdb"/>
    <JDBCTxDataSource EnableTwoPhaseCommit="true"
    JNDIName="MySQLDataSource" Name="MySQLDataSource"
    PoolName="MySQLConnectionPool" Targets="cgServer"/>
    The screen shot of the exceptions is as below:
    <2003-8-21 ÏÂÎç17ʱ14·Ö08Ãë EST> <Notice> <WebLogicServer> <BEA-000355> <Thread
    "ListenThread.Default" listening on port 7001, ip address *.*>
    java.lang.NoClassDefFoundError: weblogic/jdbc/wrapper/PoolConnection
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    3)
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(Generic
    ClassLoader.java:476)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClass
    Loader.java:181)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClass
    Loader.java:223)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:217)
    at weblogic.utils.classfile.utils.CodeGenerator.generateClass(CodeGenera
    tor.java:71)
    at weblogic.utils.wrapper.WrapperFactory.generateWrapperClass(WrapperFac
    tory.java:331)
    at weblogic.utils.wrapper.WrapperFactory.getWrapperClass(WrapperFactory.
    java:167)
    at weblogic.jdbc.wrapper.JDBCWrapperFactory.getWrapper(JDBCWrapperFactor
    y.java:66)
    at weblogic.jdbc.pool.Driver.allocateConnection(Driver.java:242)
    at weblogic.jdbc.pool.Driver.connect(Driver.java:158)
    at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:444)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:138)
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour
    ce.java:298)
    at jsp_servlet.__testmysql._jspService(__testmysql.java:129)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
    (ServletStubImpl.java:1053)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:387)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:431)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:305)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:6310)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:317)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
    118)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:3622)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2569)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    <2003-8-21 ÏÂÎç17ʱ14·Ö42Ãë EST> <Error> <HTTP> <BEA-101017> <[ServletContext(id
    =2960804,name=forum,context-path=/forum)] Root cause of ServletException.
    java.sql.SQLException: Cannot obtain connection: driverURL = jdbc:weblogic:pool:
    MySQLConnectionPool, props = {enableTwoPhaseCommit=false, jdbcTxDataSource=true,
    connectionPoolID=MySQLConnectionPool, dataSourceName=MySQLDataSource}.
    Nested Exception: java.lang.RuntimeException: Failed to Generate Wrapper Class
    at weblogic.utils.wrapper.WrapperFactory.createWrapper(WrapperFactory.ja
    va:141)
    at weblogic.jdbc.wrapper.JDBCWrapperFactory.getWrapper(JDBCWrapperFactor
    y.java:73)
    at weblogic.jdbc.pool.Driver.allocateConnection(Driver.java:242)
    at weblogic.jdbc.pool.Driver.connect(Driver.java:158)
    at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:444)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:138)
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour
    ce.java:298)
    at jsp_servlet.__testmysql._jspService(__testmysql.java:129)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
    (ServletStubImpl.java:1053)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:387)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:431)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:305)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:6310)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:317)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
    118)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:3622)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2569)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    at weblogic.jdbc.jts.Driver.wrapAndThrowSQLException(Driver.java:395)
    at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:448)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:138)
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour
    ce.java:298)
    at jsp_servlet.__testmysql._jspService(__testmysql.java:129)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
    (ServletStubImpl.java:1053)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:387)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:431)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:305)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:6310)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:317)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
    118)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:3622)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2569)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    >

    1. This assumes that you have downloaded the mysql database and configured it and started
    it by running mysqld. In my case, I installed it in d:/mysql.
    2. It also assumes that you have configured a user on the database.
    I configured a user "test" with password "test" on the database "mysql" on "localhost" using
    mysql --user=root mysql
    grant all privileges on *.* to test@localhost identified by 'test' with grant option;
    3. It assumes that you have downloaded the Connector/J zip file and pulled out the jar file.
    In my case, I renamed it and copied it to d:/mysql/lib/jdbc.jar.
    4. It is absolutely necessary that you put the jar file in your server classpath. It won't
    work without doing that. Then I booted the server.
    5. I used the WLS 8.1 console to configure the connection pool and associated data source.
    In my case, they look like the following:
    <JDBCConnectionPool DriverName="org.gjt.mm.mysql.Driver"
    Name="mysql" Password="test"
    Properties="user=test"
    Targets="myserver"
    TestTableName="SQL SELECT 1"
    URL="jdbc:mysql://localhost:3306/mysql"/>
    <JDBCTxDataSource
    JNDIName="myDataSource"
    Name="myDataSource"
    PoolName="mysql"
    Targets="myserver"/>
    Note that the console uses the old class name for the driver. There is a new class name but
    the old name still exists and we figured it would cover folks using the old and new classes.
    6. I'll attach a client program that looks up the datasource associated with the connection pool,
    gets a connection, and does some stuff with the connection.
    The user/password combination must have security priviledges in WLS to reserve a connection
    on the pool.
    The code for this program is taken almost entirely from the WLS JDBC documentation.
    This is all pretty standard stuff.
    "Roland" <[email protected]> wrote in message news:[email protected]...
    >
    Pardon me for repeating this topic. I have spent 2 days on this but still ended
    up with failure.
    The similar configuration works very well under wls7.0.
    It should not be a problem of jdbc driver or its classpath setting, since the
    system console say "successful..."
    But when I try to access jsp and servlets, it always throws execeptions. All projects
    run successfully under wls7.0 don't work.
    Please give me some advice, thanks in advance.
    The following is my connection pool setting found in config.xml:
    <JDBCConnectionPool DriverName="com.mysql.jdbc.Driver"
    Name="MySQLConnectionPool" Password="{3DES}aMsyd4ZSbSg="
    Properties="user=root" Targets="cgServer" URL="jdbc:mysql://localhost/userdb"/>
    <JDBCTxDataSource EnableTwoPhaseCommit="true"
    JNDIName="MySQLDataSource" Name="MySQLDataSource"
    PoolName="MySQLConnectionPool" Targets="cgServer"/>
    The screen shot of the exceptions is as below:
    <2003-8-21 ÏÂÎç17ʱ14·Ö08Ãë EST> <Notice> <WebLogicServer> <BEA-000355> <Thread
    "ListenThread.Default" listening on port 7001, ip address *.*>
    java.lang.NoClassDefFoundError: weblogic/jdbc/wrapper/PoolConnection
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    3)
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(Generic
    ClassLoader.java:476)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClass
    Loader.java:181)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClass
    Loader.java:223)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:217)
    at weblogic.utils.classfile.utils.CodeGenerator.generateClass(CodeGenera
    tor.java:71)
    at weblogic.utils.wrapper.WrapperFactory.generateWrapperClass(WrapperFac
    tory.java:331)
    at weblogic.utils.wrapper.WrapperFactory.getWrapperClass(WrapperFactory.
    java:167)
    at weblogic.jdbc.wrapper.JDBCWrapperFactory.getWrapper(JDBCWrapperFactor
    y.java:66)
    at weblogic.jdbc.pool.Driver.allocateConnection(Driver.java:242)
    at weblogic.jdbc.pool.Driver.connect(Driver.java:158)
    at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:444)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:138)
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour
    ce.java:298)
    at jsp_servlet.__testmysql._jspService(__testmysql.java:129)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
    (ServletStubImpl.java:1053)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:387)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:431)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:305)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:6310)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:317)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
    118)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:3622)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2569)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    <2003-8-21 ÏÂÎç17ʱ14·Ö42Ãë EST> <Error> <HTTP> <BEA-101017> <[ServletContext(id
    =2960804,name=forum,context-path=/forum)] Root cause of ServletException.
    java.sql.SQLException: Cannot obtain connection: driverURL = jdbc:weblogic:pool:
    MySQLConnectionPool, props = {enableTwoPhaseCommit=false, jdbcTxDataSource=true,
    connectionPoolID=MySQLConnectionPool, dataSourceName=MySQLDataSource}.
    Nested Exception: java.lang.RuntimeException: Failed to Generate Wrapper Class
    at weblogic.utils.wrapper.WrapperFactory.createWrapper(WrapperFactory.ja
    va:141)
    at weblogic.jdbc.wrapper.JDBCWrapperFactory.getWrapper(JDBCWrapperFactor
    y.java:73)
    at weblogic.jdbc.pool.Driver.allocateConnection(Driver.java:242)
    at weblogic.jdbc.pool.Driver.connect(Driver.java:158)
    at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:444)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:138)
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour
    ce.java:298)
    at jsp_servlet.__testmysql._jspService(__testmysql.java:129)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
    (ServletStubImpl.java:1053)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:387)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:431)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:305)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:6310)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:317)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
    118)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:3622)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2569)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    at weblogic.jdbc.jts.Driver.wrapAndThrowSQLException(Driver.java:395)
    at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:448)
    at weblogic.jdbc.jts.Driver.connect(Driver.java:138)
    at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSour
    ce.java:298)
    at jsp_servlet.__testmysql._jspService(__testmysql.java:129)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:33)
    at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
    (ServletStubImpl.java:1053)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:387)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:431)
    at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
    pl.java:305)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:6310)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:317)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
    118)
    at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
    rvletContext.java:3622)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2569)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
    >[mysql.java]

  • Problems with JSP and MySql bean.

    Hi,
    I'm new to JSP and I'm having some problems with it. I'm trying to do a simple login where a java class (bean?) handles the SQL injektion. I have deployed the page on tomcat and it works fine, except that the sqlinjektion does basically nothing. I have installed the mysql driver. I think there is something wrong with the java class, or the way im calling it. It does not produce any error. But its like it would never actually process the java code, because ive tried to append things to error string to see what is going on, nothing happens. everything stay null, no exceptions are thrown. If I implement the code to JSP itself, it does load the driver and print exception that there is no connection to database (which is correct). What am I missing? Code follows:
    the sqlhandler:
    public abstract class SqlInjektor {
         private static String Database = "*****";
         private static String serverName = "localhost:3306";
         private static String usrName="******";
         private static String passw="******";
         * @return Connection
         public static Connection createConnection(String error){
              Connection mySqlCon = null;
              try{
                   Class.forName("com.mysql.jdbc.Driver").newInstance();
              catch(Exception E){
                   PrintWriter out = response.getWriter();
                   out.println("lol");
              String url = "jdbc:mysql://" + serverName + "/" + Database + "?user=" + usrName + "&password=" + passw;
              try{
                   mySqlCon = DriverManager.getConnection(url);
              catch (Exception E){
                   E.printStackTrace(System.out);
              return mySqlCon;
         * Metodi saa sy�tteen��n SQL komennon, jonka se suorittaa sek� palauttaa komennon tulokset.
         * @param command
         * @return ResultSet
         public static ResultSet querySQL(String command,String error, Connection con){
              ResultSet rs = null;
              try{
                   Statement stmt = con.createStatement();
                   rs = stmt.executeQuery(command);
              catch(Exception E){
                   E.printStackTrace(System.out);
              return rs;
    the jsp page:
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ page isErrorPage="false" %>
    <%@ page import="java.sql.*" %>
    <%@page import="ot3.User"%>
    <%@page import="ot3.SqlInjektor"%>
    <%@page import="Javax.servlet.jsp.*"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>vastaanotto</title>
    </head>
    <body>
    <%!      String id;
         String password;
         String error = new String("Error!\n");
         User user;
    %>
    <%      user = new User();
         session.putValue("currentUser",user);
         id = request.getParameter("authName");
    password = request.getParameter("Password");
         Connection conn=null;
         ResultSet rs=null;
         conn = SqlInjektor.createConnection(error);
         if(conn!=null){
              out.println("conn ok!");
              rs = SqlInjektor.querySQL("SELECT * FROM user WHERE id='" + id +"' AND password='" + password+"' COLLATE latin1_bin;",error,conn);}
         try {
              if (rs!= null && rs.next()){
                   user.setID(rs.getInt("id"));
                   user.setName(rs.getString("name"));
                   user.setPassword(rs.getString("password"));
                   user.setClearance(rs.getInt("clearance"));
                   if(rs.getString("addedby")!=null)
                        user.setAdder(rs.getInt("addedby"));
                   if(rs.getString("lastmodifier")!=null)
                        user.setModifier(rs.getInt("lastmodifier"));
                   rs.close();%>
                   ONNISTU!
              <%}
              else {
                   out.println(error);     
         } catch (SQLException e) {
              out.println(e.getMessage());
         }%>
    </body>
    </html>

    Hi,
    I'm new to JSP and I'm having some problems with it. I'm trying to do a simple login where a java class (bean?) handles the SQL injektion. I have deployed the page on tomcat and it works fine, except that the sqlinjektion does basically nothing. I have installed the mysql driver. I think there is something wrong with the java class, or the way im calling it. It does not produce any error. But its like it would never actually process the java code, because ive tried to append things to error string to see what is going on, nothing happens. everything stay null, no exceptions are thrown. If I implement the code to JSP itself, it does load the driver and print exception that there is no connection to database (which is correct). What am I missing? Code follows:
    the sqlhandler:
    public abstract class SqlInjektor {
         private static String Database = "*****";
         private static String serverName = "localhost:3306";
         private static String usrName="******";
         private static String passw="******";
         * @return Connection
         public static Connection createConnection(String error){
              Connection mySqlCon = null;
              try{
                   Class.forName("com.mysql.jdbc.Driver").newInstance();
              catch(Exception E){
                   PrintWriter out = response.getWriter();
                   out.println("lol");
              String url = "jdbc:mysql://" + serverName + "/" + Database + "?user=" + usrName + "&password=" + passw;
              try{
                   mySqlCon = DriverManager.getConnection(url);
              catch (Exception E){
                   E.printStackTrace(System.out);
              return mySqlCon;
         * Metodi saa sy�tteen��n SQL komennon, jonka se suorittaa sek� palauttaa komennon tulokset.
         * @param command
         * @return ResultSet
         public static ResultSet querySQL(String command,String error, Connection con){
              ResultSet rs = null;
              try{
                   Statement stmt = con.createStatement();
                   rs = stmt.executeQuery(command);
              catch(Exception E){
                   E.printStackTrace(System.out);
              return rs;
    the jsp page:
    <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
    <%@ page isErrorPage="false" %>
    <%@ page import="java.sql.*" %>
    <%@page import="ot3.User"%>
    <%@page import="ot3.SqlInjektor"%>
    <%@page import="Javax.servlet.jsp.*"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>vastaanotto</title>
    </head>
    <body>
    <%!      String id;
         String password;
         String error = new String("Error!\n");
         User user;
    %>
    <%      user = new User();
         session.putValue("currentUser",user);
         id = request.getParameter("authName");
    password = request.getParameter("Password");
         Connection conn=null;
         ResultSet rs=null;
         conn = SqlInjektor.createConnection(error);
         if(conn!=null){
              out.println("conn ok!");
              rs = SqlInjektor.querySQL("SELECT * FROM user WHERE id='" + id +"' AND password='" + password+"' COLLATE latin1_bin;",error,conn);}
         try {
              if (rs!= null && rs.next()){
                   user.setID(rs.getInt("id"));
                   user.setName(rs.getString("name"));
                   user.setPassword(rs.getString("password"));
                   user.setClearance(rs.getInt("clearance"));
                   if(rs.getString("addedby")!=null)
                        user.setAdder(rs.getInt("addedby"));
                   if(rs.getString("lastmodifier")!=null)
                        user.setModifier(rs.getInt("lastmodifier"));
                   rs.close();%>
                   ONNISTU!
              <%}
              else {
                   out.println(error);     
         } catch (SQLException e) {
              out.println(e.getMessage());
         }%>
    </body>
    </html>

  • Syntac error in JSP and MySQL

    HI guys,
    I have been facing another problem. The codings below. Worked well with my JSP and Access database.
    Then I transfered my database to MySQL and it gives out syntax error in my SQL statement.
    CODE1:
         sql = "SELECT Week, SUM (Total_Inspected) AS ins, SUM (Total_Rejected) AS rej, SUM (Total_Accepted) AS acc, SUM (DPPM) AS dpp, SUM (Yield) AS yeel FROM Calc_Data WHERE MONTH(Inspect_Date) ="+bulann+" GROUP BY Week";
         ResultSet rs = stm.executeQuery(sql);
    CODE2:
    String query   = "SELECT ID, Model, Lot_No, Lot_Qty, Inspected_By, Reject_Desc, Area_Concerned, Location, Remark FROM OQA WHERE Customer = '"+customer+"' AND Inspect_Date =#"+tarikh+"#";
    ResultSet rs   = stmt.executeQuery(query);

    Whenever you have this type of problem, the easiest
    solution is to take the sql and try running it
    directly. For MySQL, you can either use the
    command-line client, or there are a few graphical
    clients that can handle it. Just type in the query,
    run it, and let the database itself tell you what the
    error is.
    In any case, you probably won't find much useful
    advice on a JSP forum, esp. since the problem has
    absolutely nothing to do with JSP.Indeed - I agree with this. - MOD

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

  • JSP and DB2 Connection

    I tried to use this class in my jsp page to connect to the DB2 database, However, no data from the DB appears on the page and i get no errors whatsoever. Can anyone be kind enough to take a look? Thanks
    package WH;
    import java.sql.*;
    import java.sql.Statement;
    public class DbConnect1 {
    private String dbUser = "XXX";
    private String dbPasswd = "XXX";
    private String dbDriver = "COM.ibm.db2.jdbc.app.DB2Driver";
    private String dbURL = "jdbc:db2:http://xx.xx.xxx.xx:8080/invsys";
    private Connection dbCon;
    public DbConnect1(){}
    public boolean connect() throws ClassNotFoundException,SQLException{
    try
    Class.forName(dbDriver);
    System.out.println("Loaded the instantDB JDBC driver.");
    dbCon = DriverManager.getConnection(dbURL, dbUser, dbPasswd);
    System.out.println("Created and connected to database TimingTest");
    return true;
    catch (Throwable e)
    e.printStackTrace();
    System.out.println("FAIL LAHHHHHHHHHHHH");
    return false;
    public void close() throws SQLException{
    dbCon.close();
    //accepts the SQL query in the form of a string from the JSP file in which this bean is implemented
    public ResultSet execSQL(String sql) throws SQLException{
    System.out.println("haha");
    //initiates the connection with the dbCon connection object
    Statement s = dbCon.createStatement();
    ResultSet r = s.executeQuery(sql);
    return (r == null) ? null : r;
    public int updateSQL(String sql) throws SQLException{
    Statement s = dbCon.createStatement();
    int r = s.executeUpdate(sql);
    return (r == 0) ? 0 : r;

    Here is a copy of my JSP file.
    <%@ page language='java' %>
    <%@ page import="java.sql.*" %>
    <jsp:useBean id="DbConnectBean1" scope="page" class="WH.DbConnect1" />
    <%
         //Get status
         /*String message;
         String status = request.getParameter("status").trim();
         if (status == "duplicateEmail")
         message="Please try again. An account with the same emaill address has already been created.";
         else if (status == "deleteOk")
         message="Delete successful.";
         else
              message="";*/
    //Get Contacts
         String name;
         String email;
         String extNo;
         String phoneNo;
         String remarks;
         String SQLstmt;
         SQLstmt = "Select * from CONTACT";
    if (DbConnectBean1.connect()==true){
    %>
    <html>
    <head>
    <title>Display Contacts</title>
    <script src="validation.js" language="Javascript"></script>
    <script Language="JavaScript">
    //Perform Validation
    /* function checkForm() {
    var alertString=checkChkBox(theForm.chkItem.value);
         formSubmit(alertString);
    </script>
    </head>
    <body bgcolor="#ffffff">
    <form action="USRDelContact.jsp" name="theForm" onsubmit="return checkForm();">
    </form>
    <table>
    <tr>
    <td><input type="chkAll" id="chkAll"onclick="checkAll(document.theForm.chkItem)"/></td>
    <td>Name</td>
    <td>Extension No.</td>
    <td>Mobile Phone No.</td>
    <td>Email Address</td>
    <td>Remarks</td>
    <td> </td>
    </tr>
    <%
         ResultSet r = DbConnectBean1.execSQL(SQLstmt);
         while (r.next()){
    %>
    <tr>
    <td><input type="checkbox" name="chkItem" id="chkItem" value="<%= r.getString("Email")%>"/></td>
    <td><%= r.getString("Emp_Name")%></td>
    <td><%= r.getString("Ext_No")%></td>
    <td><%= r.getString("Cellphone")%></td>
    <td><a href="mailto:<%= r.getString(Email")%">"><%= r.getString("Email")%></a></td>
    <td><%= r.getString("Remarks")%></td>
    <td><a href="USREditContact.jsp?email=<%= r.getString("Email")%>">Edit</a></td>
    </tr>
    <%
    if (r.next()==false)
    %>
    <tr>
    <td colspan="7">There are no records currently.</td>
    </tr>
    <% }
    }//end if%>
    <tr colspan="6">
    <td>
    <%//=message%> <input type="submit" name="btnDelete" value="Delete">
    </td>
    </tr>
    </table>
    </form>
    </body>
    </html>
    </a>

  • CS6, FTP and MySQL Connection ERRORs

    Adobe CS6 Dreamweaver
    I have the latest + updates of CS6 for Mac OS X 10.7.4.latest
    I can FTP, but files are not readable after the upload, on any web hosting provider.
    I have to use a thrid party FTP application (CyberDuck or Trnsmit) to make this happen.
    NOT HAPPY about this £2500 CS6 Master Collection spend not working !!!!
    When I try to connect via MySQL I get this error and failed actions:
    https://dl.dropbox.com/u/5485939/adobe_CS6_dreamweaver_FTP_MySQL/Screen%20Shot%202012-07-1 3%20at%2011.11.57.png
    https://dl.dropbox.com/u/5485939/adobe_CS6_dreamweaver_FTP_MySQL/Screen%20Shot%202012-07-1 3%20at%2011.11.45.png
    https://dl.dropbox.com/u/5485939/adobe_CS6_dreamweaver_FTP_MySQL/Screen%20Shot%202012-07-1 3%20at%2011.11.19.png
    I have checked the folders & content for ...
    _mmServerScripts
    Connections
    are uploaded properly (having to use a third party FTP application, see above).
    I have the correct logins details for FTP and MySQL, as other MySQL Apps (Sequel Pro) have no problem connecting to any web hosting proivdier for MySQL using the exact same login details.
    This is the same on my iMac or my MacBook Pro.

    Hello David, I am having this issue getting errors while trying to get my SQL to connect with the server. I clicked on the link you provided and I get a "you do not have permission to view this" message. Can you please share what ever solution that adobe has with me too.
    I am really really irritated with this issue, as someone else stated this is really inconvenient when I want to get some work done. I am also upset that I bought this software, especially if I cant find a solution.

  • JSP with MySQL connection in Tomcat6.0.20

    Hi i'm using MySQL5.1, Tomcat6.0.20 in my project, There i'm not able to connect to the database. it's giving the error.
    My program is :
    <%@ page language="java" import="java.sql.*" %>
    <%
         String driver = "org.gjt.mm.mysql.Driver";
         Class.forName(driver).newInstance();
         try{
              String url="jdbc:mysql://localhost/books?user=root@localhost&password=india123";
              Connection con=DriverManager.getConnection(url);
              Statement stmt=con.createStatement();
         catch(Exception e){
              System.out.println(e.getMessage());
         if(request.getParameter("action") != null){
              String bookname=request.getParameter("book_name");
              String author=request.getParameter("author");
              stmt.executeUpdate("insert into books_lib(book_name,author) values('"+bookname+"','"+author+"')");
              ResultSet rst=stmt.executeQuery("select * from books_lib");
              %>
              <html>
              <body>
              <center>
                   <h2>Books List</h2>
                   <table border="1" cellspacing="0" cellpadding="0">
                   <tr>
                        <td><b>S.No</b></td>
                        <td><b>Book Name</b></td>
                        <td><b>Author</.b></td>
                   </tr>
                        <%
                        int no=1;
                        while(rst.next()){
                        %>
                        <tr>
                        <td><%=no%></td>
                        <td><%=rst.getString("book_name")%></td>
                        <td> <%=rst.getString("author")%> </td>
                        </tr>
                        <%
                        no++;
         rst.close();
         stmt.close();
         con.close();
    %>
                   </table>
                   </center>
              </body>
         </html>
    <%}else{%>
         <html>
         <head>
              <title>Book Entry FormDocument</title>
              <script language="javascript">
              function validate(objForm){
                   if(objForm.bookname.value.length==0){
                   alert("Please enter Book Name!");
                   objForm.bookname.focus();
                   return false;
                   if(objForm.author.value.length==0){
                   alert("Please enter Author name!");
                   objForm.author.focus();
                   return false;
                   return true;
                   </script>
              </head>
              <body>
                   <center>
    <form action="BookEntryForm.jsp" method="post" name="entry" onSubmit="return validate(this)">
         <input type="hidden" value="list" name="action">
         <table border="1" cellpadding="0" cellspacing="0">
         <tr>
              <td>
                   <table>
                        <tr>
                        <td colspan="2" align="center">
    <h2>Book Entry Form</h2></td>
                        </tr>
                        <tr>
                        <td colspan="2"> </td>
                        </tr>
                        <tr>
                        <td>Book Name:</td>
                        <td><input name="bookname" type="text" size="50"></td>
                        </tr>
                        <tr>
                        <td>Author:</td><td><input name="author" type="text" size="50"></td>
                        </tr>
                        <tr>
                             <td colspan="2" align="center">
    <input type="submit" value="Submit"></td>
                             </tr>
                        </table>
                   </td>
              </tr>
         </table>     
    </form>
                   </center>
              </body>
         </html>
    <%}%>
    The error page is:
    HTTP Status 500
    org.apache.jasper.JasperException: Unable to compile class for JSP:
    An error occurred at line: 19 in the jsp file: /singleupload/BookEntryForm.jsp
    stmt cannot be resolved
    16:      if(request.getParameter("action") != null){
    17:           String bookname=request.getParameter("book_name");
    18:           String author=request.getParameter("author");
    19:           stmt.executeUpdate("insert into books_lib(book_name,author) values('"+bookname+"','"+author+"')");
    20:           ResultSet rst=stmt.executeQuery("select * from books_lib");
    21:           %>
    22:           <html>
    An error occurred at line: 20 in the jsp file: /singleupload/BookEntryForm.jsp
    stmt cannot be resolved
    17:           String bookname=request.getParameter("book_name");
    18:           String author=request.getParameter("author");
    19:           stmt.executeUpdate("insert into books_lib(book_name,author) values('"+bookname+"','"+author+"')");
    20:           ResultSet rst=stmt.executeQuery("select * from books_lib");
    21:           %>
    22:           <html>
    23:           <body>
    An error occurred at line: 45 in the jsp file: /singleupload/BookEntryForm.jsp
    stmt cannot be resolved
    42:                     no++;
    43:      }
    44:      rst.close();
    45:      stmt.close();
    46:      con.close();
    47: %>
    48:                </table>
    An error occurred at line: 46 in the jsp file: /singleupload/BookEntryForm.jsp
    con cannot be resolved
    43:      }
    44:      rst.close();
    45:      stmt.close();
    46:      con.close();
    47: %>
    48:                </table>
    49:                </center>
    Stacktrace:
         org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
         org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
         org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
         org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
         org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    Please help me

    ?An error occurred at line: 20 in the jsp file: /singleupload/BookEntryForm.jsp stmt cannot be resolved
    That means it can't see any variable declared called "stmt"
    There isn't one at this point.
    The stmt variable you have declared up above, is nested in curly braces - within your try/catch statement. As such it only has scope within those curly braces. If you want to use stmt outside of the try block, you need to declare stmt outside of it.
    And yes, I echo Balusc's comments about scriptlet code in a jsp page.
    A better solution would be to write a java class with a method that does the database query, and returns a List of objects.
    Your JSP can then take that list of objects and display them on the page.
    Its a bit more work, but makes the code much easier to write/maintain/test because you separate out the "data" and "view" layers.

  • JDBC and MySQL connectivity problem

    The code i hav attached generates Connectivity exception.. the prob is with the part in bold.. can anyone help
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class testconn {
      public static void main(String args[]) {
        Connection con = null;
                String serverName = "localhost:8080";
            String mydatabase = "imagedb";
            String url = "jdbc:mysql://" + serverName +  "/" + mydatabase; // a JDBC url
            String username = "am";
            String password = "ta";
        try {
          Class.forName("com.mysql.jdbc.Driver");
         con= DriverManager.getConnection(url, username, password);
          if(!con.isClosed())
            System.out.println("Successfully connected to " +
              "MySQL server using TCP/IP...");
        } catch(Exception e) {
          System.err.println("Exception: " + e);
        } finally {
          try {
            if(con != null)
              con.close();
          } catch(SQLException e) {}
    }

    I had such issue too, and I fixed it by adding in the environment variables the CLASSPATH entry that pointed to all the directories containing the .jar needed for the applications.
    for example I used jodbc folder to connect mysql database (I installed last version and I got same issue than yours and it seems to be a 'connector' issue, exactly the same issue than yours) I got something like
    CLASSPATH=my root dir/the java dir/the lib dir/jodbc;my root dir/the java dir/other important libs containing .jar files;
    This is what I got for the issue, still working around (at the level of mysql all is ok, ...)
    Microsoft Windows XP [version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    C:\Documents and Settings\Hurukan>java ConnectJODBC brol
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at ConnectJODBC.main(ConnectJODBC.java:108)
    [exception] -- la valeur de 'con' est nulle (DriverManager � retourn� une valeur
    nulle)
    C:\Documents and Settings\Hurukan>set
    APPDATA=C:\Documents and Settings\Hurukan\Application Data
    CLASSPATH=c:\Program Files\Java\jdk1.5.0_06\lib;c:\Program Files\Java\jdk1.5.0_06\dev;\c:\Program Files\Java\jdk1.5.0_06\lib\jodbc;
    Here is the code that generated this exception
    String dburl="jdbc:mysql://127.0.0.1/nosdisques"; // should be next passed by command line
    String password="**scrambled**";
    String username="**scrambled**";
    Connection con=null;
    Statement stmt=null;
    ResultSet res=null;
    String requete="";
    String strToWrite="";
    // Connexion � la base de donn�e
    // Won't work with mysql 5.0.18, mysql connector 3.51.12 is installed [???]
    // Previous tests with 5.0.18 were running good, that has started with the last os restoration (and the connector was different of course...)
    // tried to retreive older version of the mysql connector
    try
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con=DriverManager.getConnection(dburl,username,password);
    System.out.println("Nous sommes connect\u201as \u2026 la base " + con.getCatalog());
    catch(SQLException sqlex)
    System.out.println("[sqlexception]\n");
    System.exit(3);
    catch(Exception ex)
    ex.printStackTrace();
    if(con == null)
    System.out.println("[exception] -- la valeur de 'con' est nulle (DriverManager \u2026 retourn\u201a une valeur nulle)\n");
    System.exit(4);
    System.out.println("Impossible to join database, access denied\n");
    System.out.println("Verify settings (mysqld or firewall)\n"); System.exit(2);
    Maybe the drivers used (last one: connector/j 3.1.12). The .jar file is in the %classpath% directory c:\Program Files\Java\jdk1.5.0_06\lib.
    Can't really understand why this code won't run anymore, ...
    I took a look on the other computer where the same code is running ok.
    These are the differences:
    mysql server is 5.0.18 on the other computer the version is 3.23.41
    mysql connector is 3.51.12 on the other computer the version is 3.0.10
    access rights are the same because the database is the dumped one from 3.23.41 to 5.0.18, and I'm quite good with the dbms management (I'm IT developper in fact, trying to take over java technology ;) )
    in this case this is not a sql error but java error.
    the jar file is set to the %classpath% folder on both computers
    I copied the jar from the other computer, removing the new .jar file and... it failed, exactly the same issue
    Still working around, ...
    Dimitri

  • JSP and MySQL

    dear all,
    I am new to sql and database programming and am a bit confussed about the line:
    Connection Conn = DriverManager.getConnection("jdbc:mysql:dbname");
    the jdbc is the what is the dbname??? is it the address of the database on your hard drive??? how is it formated??? what is the file that you need to point to??? how dies this work
    Thanks T

    Hi
    the JDBC Url should have the following format
    jdbc:mysql://<hostname>:<port>/<database>
    If your MySQL Database is running at your local host
    and it is using the default port than you can use
    jdbc:mysql://127.0.0.1:3306/test
    jdbc -> Means you are trying to open a jdbc connection
    mysql -> MySQL Databse Driver
    (make sure that your MySQL jdbc driver is registered)
    to connect to the test database on your MySQL Server
    regards
    thsimon

  • JSP and Database connectivity

    Hello!
    I have Tomcat 4.0. and my database file is in Access (emp.mdb)
    I want to connect this Data file from JSP, for that any Driver I have to
    install? like JDBC driver...
    What is the steps and How do I connect? Pl. reply me.
    Thax,
    regards
    mohan

    Dear Amn,
    I am giving sample program. Just change the emp.mdb file path and run this jsp program.
    Then you can see the driver information etc.,
    if you get any problem, please call me at [email protected]. then i will give u solution assp.
    Thank you very much.
    all the best.
    Yours
    Rajesh
    <title>Database Test</title>
    <font face="verdana" size=2 color="blue">
    <%@page import="java.sql.*"%>
    <%
         Connection con=null;
         Statement st=null;
         try
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              con = DriverManager.getConnection("jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=C:/emp.mdb","","");
              st=con.createStatement();
              out.println("Connected To Database ");
              out.println("<BR><BR>");
              DatabaseMetaData md = con.getMetaData();
              out.println("Driver Name " + md.getDriverName());
              out.println("<BR><BR>");
              out.println("Driver Version " + md.getDriverVersion());
              out.println("<BR><BR>");
              out.println("Database URL is " + md.getURL());
              out.println("<BR><BR>");
              out.println("Database UserName is " + md.getUserName());
              out.println("<BR><BR>");
              out.println("Connection Name " + md.getConnection());
              out.println("<BR><BR>");
              out.println("Database Name " + md.getDatabaseProductName());
              out.println("<BR><BR>");
              out.println("Database Version " + md.getDatabaseProductVersion());
              out.println("<BR><BR>");
              out.println("Database ReadOnly Type " + md.isReadOnly());
              out.println("<BR><BR>");
              out.println("MaxColumnNameLength " + md.getMaxColumnNameLength());
              out.println("<BR><BR>");
              out.println("MaxConnections " + md.getMaxConnections());
              out.println("<BR><BR>");
              out.println("");
    catch(Exception e)
         out.println(e);
         finally
              try {
                   if(st != null) {
                        st.close();
                        st = null;
                   if(con != null) {
                        con.close();
                        con = null;
              } catch (SQLException e) {}
    %>

  • Jsp and database connection using bean

    * I want create a bean to handle database connectivity.The
              <jsp:usebean> tag uses
              no argument constructor ..so I cannot pass the userid and password to
              the constructor.
              So how can I create a database connection when the user_id and password
              will be a part of parameter ?
              * Now I'm opening database connection in the jsp scriplets. Everytime I
              refresh the
              jsp page a new connection is created ? Is it not going to choke the
              database ? I cannot use connection pool because every user logs in with
              different userid.
              Thanks
              

    You can pass your arguments in this way:
              <jsp:usebean id="myBean" scope="page"/>
              <jsp:setProperty name="myBean" property="userId", value=<%= user_id%>/>
              <jsp:setProperty name="myBean" property="password", value=<%=
              user_password%>/>
              of course, in your bean class, you should create two setter methods,
              setUserId and setPassword.
              Hopefully, this will help you.
              sonia WEN
              Chiranjib Misra wrote:
              > * I want create a bean to handle database connectivity.The
              > <jsp:usebean> tag uses
              > no argument constructor ..so I cannot pass the userid and password to
              > the constructor.
              > So how can I create a database connection when the user_id and password
              > will be a part of parameter ?
              >
              > * Now I'm opening database connection in the jsp scriplets. Everytime I
              > refresh the
              > jsp page a new connection is created ? Is it not going to choke the
              > database ? I cannot use connection pool because every user logs in with
              > different userid.
              >
              > Thanks
              

Maybe you are looking for

  • Adding features to the remote

    First, I really like both the remote, and the description included with the remote, while improvements might be made, they are examples of the best available.  I have 1 problem with the remote, and I wonder if it might be possible to get one addition

  • Combined Stacked and side-by-side bar chart?

    I need to create a chart where I for each group (x axis) have two bars where each bar has two stacked values. Is this possible to do? I found one method which seems to work and that is using the dual Y axis to group the values into two groups. Questi

  • How to populate a jcombobox ?

    i am seeking for a good code sample that allows me to populate a jcombobow with the result of a reslutset ! i mean to populate it with the entire elements of the returned resultset !! could you please help me !!

  • Is there really a korean made iphone 4s?

    is there really a korean made iphone 4s? if there is, how much it is being sold in the market?

  • Need help if possible

    Trying to get music from ipod touch to library