Database connectivity with java!

hello, has anyone got a "detailed" tutorial they can send on:
1.setting up mySQL database (not just install)
2.setting up J/connector (not just install)
3.a tutorial on how i can get a servlet to interact with a client through a webpage!
does it sound like i'm trying to learn how to do 5things at once? well your right... i want to start small, but i need to learn SQL to set up a database, and i need to j/connector to interact with the database.
i'm less worriered about the third point at the moment, because there is a sun tutorial i've been looking at!
any help would be more then appreciated!

1.) use the mySQL documentation (it's not that bad)
2.) see the j2ee tutorial (http://java.sun.com/j2ee/1.4/docs/tutorial/doc/ - chapter 11 is about servlets)
3.) learn something about HTML and HTML formulars, your servlet could interpret the parameters transmitted from formulars (by HTTP GET, HTTP POST, ...)
4.) discover the API documentation for the packages javax.servlet and javax.servlet.http to learn more about the possibilities
5.) try it out (e.g. create a servlet which presents all the servlet parameters which are available: servlet information, request information, response information, ...)
6.) have fun!
hope it helps...

Similar Messages

  • AIR application and database connectivity (using JAVA)

    Hi
    I am creating AIR application and I want to connect with the database using java database connectivity (JDBC).
    Can any body give me the some suggestion on how to how to do that.
    Please give me any reference for creating AIR application for database connectivity with mysql/access.
    Thanks
    Sameer

    lots of serching on the google and found that For AIR applications either you use Webservices(JAVA/PHP/.Net) or you can use SQLLite.
    Not found any method for direct connectivity with the database using JDBC.
    If any one found direct connecivity withe database using JAVA then please reply.
    Thanks

  • NetBean, I can't establish the oracle database connection with version 9i.

    In NetBean, I can't establish the oracle database connection with version 9i.
    I have create the datasource and it is fine.
    when i try to access the tables i get a message
    "Unable to refresh children, connection is broken, unsupported feature"
    in netbeans.
    Does netbeans support oracle 9i version.
    Thanks,
    VKK

    In NetBean, I can't establish the oracle database connection with version 9i.
    I have create the datasource and it is fine.
    when i try to access the tables i get a message
    "Unable to refresh children, connection is broken, unsupported feature"
    in netbeans.
    Does netbeans support oracle 9i version.
    Thanks,
    VKK

  • How to use Forms Default Database Connection in java class

    When a form based application is started, a connection is made with underlying database. This is the Default (Primay) Database Connection.
    The problem is I have some of my business logic implemented in a java class. In this class I have to make a another connection with the same database. What I want to do is to use the original Database Connection in the java class. In this I may avoid the overhead of reconnection.
    Could anyone pls guide me in this way...

    you can't share the forms connection. Sorry :(

  • Database connectivity with MS Acess using WSAD5.1

    I am using WSAD5.1 as IDE and development tool. I am trying to connect to MS Access database using following lines of code
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //.newInstance();
    dbConnection = DriverManager.getConnection("jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=C:\\customers.mdb");
    I tried creating system DSN and changing url as "jdbc:odbc:Test" where Test is DSN.
    I have rt.jar file in my class path.
    When I run this program from command prompt I am getting connectivity with proper results.
    The problem is when it is run with WSAD inweb project I am getting an error
    "java.sql.SQLException: No suitable driver".
    Am I required to change any environmental settings?

    try this Code
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    dbConnection = DriverManager.getConnection("jdbc:odbc:test"); <Here Test is the driver name>and add the tools.jar file in the IDE li directory or in to the Project path of the IDE

  • Create database connection with Mysql

    Hi, all:
    inside JDeveloper, i try to create a database connection for Mysql (third party
    JDBC driver). I input all needed parameters into
    JDeveloper database connection dialog, and test connection, the error message
    says 'Unable to find driver org.gjt.mm.mysql.Driver". The jar file contains driver
    is listed in system classpath, and Mysql and MM-Mysql JDBC driver are tested with
    other applications and there is no problem.
    So, what i should do to create such a connection ??
    Any help will be appreciated. thank you in advance.
    kevin.

    The connectio URL could look like this:
    (leave the User-, Password-, and Role-fields, in the tab before, empty)
    Java Class Name: org.gjt.mm.mysql.Driver
    URL: jdbc:mysql://localhost:3306/test?ultradevhack=true&?user=myuser&?password=mypassword

  • Database connection with mysql

    i have my server as follows:
    import java.rmi.*;
    public class JobServer
    public static void main(String[] args)
    try
    JobImpl j = new JobImpl();
    Naming.rebind("//"+"localhost"+"/JobImpl",j);
    System.out.println("Registered");
    catch (Exception e)
    System.out.println("Exception occured in JobServer ... " +e);
    and my interface implementation:
    import java.rmi.*;
    import java.rmi.server.*;
    import java.sql.*;
    public class JobImpl extends UnicastRemoteObject implements JobInt
    String host="localhost";
    String user="root";
    String pass="admin";
    String db="db";
    String conn;
    ResultSet rs;
    Statement st;
    public JobImpl() throws RemoteException
    super();
    try
    Class.forName("com.mysql.jdbc.Driver");
    conn = "jdbc:mysql://" + host + "/" + db + "?user=" + user + "&password=" + pass;
    Connection Conn = DriverManager.getConnection(conn);
    st = Conn.createStatement();
    catch (Exception e)
    System.out.println("problem while establishing connection"+e);
    public String getname(int jobno) throws RemoteException
    try
    rs = st.executeQuery("Select name from job whwre jobno="+jobno);
    rs.next();
    return(rs.getString("name"));
    catch (Exception e)
    e.printStackTrace();
    return null;
    when i 'javac JobServer' on the command prompt, i have the following error:
    problem while establishing connection java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    Exception occured in JobServer ... java.rmi.ConnectionException: Connection refused to host: localhost; nested exception is :
    java.net.ConnectionException: Connection refused: connect
    apparently theres a problem with my database connection... the connection isnt right? plz help

    problem while establishing connection
    java.lang.ClassNotFoundException:
    com.mysql.jdbc.DriverSo fix that first. It's just a matter of installing the MySQL JAR file(s) in the appropriate place, i.e. somewhere on your CLASSPATH. Read their documentation.

  • SQL Server Database Connectivity with Visual Studio 2012 - Help Needed

    Hello,
    I am having Visual Studio 2012 and SQL Developer 4.0 installed on my system with Windows 8 - 64bit
    I want to shift a VS project with an SQL database connectivity to another new Laptop (above mentioned) ...
    I have the project opened in VS without bieng connected to the database.. 
    I have a backup file of the database (which needs to be restored to a new created database on SQL Developer) 
    The problem:
    I am unable to create a server connection in SQL Developer which will allow me to create a new database followed by the recovery from backup file.
    I am getting the following error message when I try to create a connection:
    Status: Faliure - IO error: The network adapter could not establish a connection
    Please help me in setting up a server connection and adding a new sql database

    The error message seemed unfamiliar to me and since I had never heard of SQL Developer before, I went to Google. Google might be pulling my legs, but it appears that SQL Developer is related to Oracle. This forum is devoted to SQL Server, so you are in the
    wrong place.
    Try finding a forum for SQL Developer.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • How to get total number of Database connections from Java code

    Hi,
    I am using Myql4.1.12.
    I am conncting to mysql through Java.
    I want to know how many active database connections were running at a specific time. Is it possible?
    Can you please help me.
    Thanks in advance.

    Seems like this would be a question for MySql, not for Java. And if it's possible you'd run some MySql utility to do that, not code it in a Java app.

  • Create database view with Java Dictionary

    Hi,
    is there a possibility to create and deploy a database view with the
    Java Dictionary (in SAP NetWeaver Development Studio)?
    It seems as if you can only create and deploy database tables.

    or else, with prior versions, use somethinig like this...
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/7094c365-e8c4-2910-62b6-93712dd555d4

  • How TO use configurable Database connection with ADF BC

    I have developed a simple JSF/ ADF BC web application that connects to a database and read/display data from the db tables. I have successfully deployed the application to Tomcat 5.5.17. However, now i need to change the database the application is connecting to. My question is How can I change the Database connection without having to change the application modules or rebuild the war file ??? In other words, is there a specific file (xml) where the database connection can be changed?

    If you set up the application with a data source (I am not sure if this is possible using another app server, I use OC4J), then you would just change it there. However if you created a database connection in the JDEV and pointed your data model to that, then you will have to change and rebuild.
    You might be able to edit the xml file that contains the setttings, I am not sure my CM guys dont allow this, all of our changes have to go through our code repository.

  • How to control tcp connection with java tcp socket programing ??

    Hi,
    I am connecting a server as using java socket programming.
    When server close the connection (socket object) as using close() method ,
    I can not detect this and My program continue sending data as if there is a connection with server.
    How to catch the closing connection ( socket ) with java socket programming.
    My Client program is as following :
    import java.io.PrintWriter;
    import java.net.Socket;
    public class client
      public client()
       * @param args
      public static void main(String[] args)
        Socket socket=null;
        PrintWriter pw=null;
        try
                          socket = new Socket("localhost",5555);
                          pw = new PrintWriter(socket.getOutputStream(),true);
                          int i=0;
                          while (true)
                            i++;
                            pw.println(i+". message is being send.");
                            Thread.sleep(5000);
        } catch (Exception ex)
                          ex.printStackTrace();
        } finally
                          try
                            if(pw!=null)pw.close();
                            if(socket!=null)socket.close();
                          } catch (Exception ex)
                            ex.printStackTrace();
                          } finally
    }

    I changed the code as following. But I couldn't catch the EOFException when I read from the socket. How can I catch this exception ?
    import java.io.BufferedReader;
    import java.io.EOFException;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.PrintWriter;
    import java.net.Socket;
    import java.net.UnknownHostException;
    public class client
      public client()
       * @param args
      public static void main(String[] args)
        Socket socket=null;
        PrintWriter pw=null;
        BufferedReader bufIn=null;
        InputStreamReader inRead=null;
        InputStream in=null;
        try
                          socket = new Socket("localhost",5555);
                          in = socket.getInputStream();
                          inRead = new InputStreamReader(in);
                          bufIn = new BufferedReader(inRead);
                          pw = new PrintWriter(socket.getOutputStream(),true);
                          int i=0;
                          while (true)
                            i++;
                            try
                              bufIn.readLine();
                              pw.println(i+". message is being send.");
                              System.out.println(i+". message has been send");
                            } catch (Exception ex2)
                              System.out.println(ex2.toString());
                              System.out.println(i+". message could not be send");
                            } finally
                            Thread.sleep(5000);
        } catch (EOFException ex)
                          ex.printStackTrace();
        } catch (InterruptedException ex)
                          ex.printStackTrace();
        } catch (IOException ex)
                          ex.printStackTrace();
        } finally
                          try
                            if(pw!=null)pw.close();
                            if(socket!=null)socket.close();
                          } catch (Exception ex)
                            ex.printStackTrace();
                          } finally
    }

  • Database connection problem java.lang.ArrayIndexOutOfBoundsException

    Hi,
    I am using Interstage server 7 and Oracle 11g for upgradation of project, application compilation is fine, but when I run the application its giving database connection exception.
    Full stack trace like below. JDK version is 1.3. can anybody tell me what may be the problem?
    2010-11-22 15:16:42 - ConnectionPool()
    java.lang.ArrayIndexOutOfBoundsException
         at oracle.security.o3logon.C1.r(C1)
         at oracle.security.o3logon.C1.l(C1)
         at oracle.security.o3logon.C0.c(C0)
         at oracle.security.o3logon.O3LoginClientHelper.getEPasswd(O3LoginClientHelper)
         at oracle.jdbc.ttc7.O3log.<init>(O3log.java:291)
         at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:257)
         at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:307)
         at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:442)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:321)
         at java.sql.DriverManager.getConnection(DriverManager.java:512)
         at java.sql.DriverManager.getConnection(DriverManager.java:172)
         at jp.tt.framework.db.DBConnection.getConnection(DBConnection.java:65)
         at jp.tt.framework.db.DBConnection.getConnection(DBConnection.java:88)
         at jp.tt.framework.db.ConnectionPool.<init>(ConnectionPool.java:38)
         at jp.tt.framework.BaseCommon.<clinit>(BaseCommon.java:217)
         at jp.tt.framework.core.Crypt.getInstance(Crypt.java:79)
         at org.apache.jsp.menu_jsp._jspService(menu_jsp.java:53)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:309)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:239)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:362)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:246)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:511)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:270)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:412)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:301)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2515)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:249)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:184)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.RequestFilterValve.process(RequestFilterValve.java:370)
         at org.apache.catalina.valves.RemoteAddrValve.invoke(RemoteAddrValve.java:137)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:232)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:646)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:436)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:806)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
         at java.lang.Thread.run(Thread.java:479)
    Thanks in advance
    Manjunath
    Edited by: 814259 on 2010/11/21 23:47
    Edited by: 814259 on 2010/11/21 23:49

    Thank you for the replies
    The problem got solved. Problem was older version of Oracle driver was placed in WEB-INF/lib and a directory called lbrary(we created it) above WEB-INF, we were placed newer version of driver in oracle's jdbc/lib directory and specified that path in classpath. But by default the older version was prioritized and used by application so we were getting the exception mentioned. When we deleted older version of driver everything got working. This explation may help for those who have similar type of problems.
    Thanks

  • Possible to Get Database backup with java program

    Hello
    Is it possible to Get or Create Database Backup on runtime with java program using some sql statements
    How could i do that
    '

    Cross posted and multi-posted.
    Hey jackass why don't you look where I already answered this question.
    http://forum.java.sun.com/thread.jspa?threadID=654902&messageID=3849575

  • SAS connectivity with JAVA

    Hi,
    I have a piece of code to connect to SAS data set i have taken the drivers provided by SAS and the below code is giving error saying server not accepting userid/password but with that userid and password i can connect to SAS in other applications can any body suggest what's wrong with this.
    Driver driver=(Driver)  Class.forName("com.sas.net.sharenet.ShareNetDriver").newInstance();         System.out.println("Driver loaded");         System.out.println("JDBC:"+driver.jdbcCompliant());         String url="jdbc:sharenet://164.56.174.116:8591";         Properties credentials=new Properties();         credentials.put("user","userName");         credentials.put("password","Password");         Connection connection=driver.connect(url,credentials);         System.out.println("Connection made");         connection.close();         System.out.println("Connection closed");
    i am getting this error
    Exception in thread "main" java.sql.SQLException: Sharenet.S58.ex.txt: Sharenet.S279.ex.txt: Sharenet.S06.ex.txt: Userid/Password not accepted by server...         at com.sas.net.sharenet.ShareNetConnection.<init>(ShareNetConnection.java:219)         at com.sas.net.sharenet.ShareNetDriver.connect(ShareNetDriver.java:165)

    Once you get past actually getting a driver the configuration of it is entirely driver dependent.
    There are at least four ways that I can't think of to do use validation. There could be others. They way you have choosen, if supported at all, might be dependent on the exact name used. For example (not necessarily a solution) it could be that instead of 'user' you need 'usr' or 'User'.
    Often this involves looking at the driver documentation and just guesssing until something works.

Maybe you are looking for

  • SAP Source System showing up as BI Source System in RSA1

    I have 2 BW systems and 2 CRM Systems.  In one BW system, when I create a SAP Source system in RSA1, It gets listed as a SAP Sources system along with ECC and all the rest. The Logicial Systems and RFC Connections all appear to be the same between ea

  • How to create a node in an interface in SFP transaction

    Dear All I am designing an Adobe forms template for which I am creating an interface. To pass the values I need to create a main node which contains both subnodes and attributes. How can we create a node for an interface? Just to add, this node will

  • Broadcast To Multiple Locations?

    Trying to output to multiple servers - tried launching multiple window of FMLE - but get an error message with the second broadcast attempt.  Any ideas?

  • Masking image in Indesign

    Hi there, I searched the web about masking object in ID, but the way I found seems a bit odd, so I feel there has to be some other, elegant way... Just additional info: I do package for socks. What I have: Plain imported PSD: paper texture. IMG 01 Sh

  • IPhoto Library file "grayed out"

    When I start up iPhoto, it prompts me to choose a library. My library file is "grayed out", not letting me choose it. Any help? I'd like to try and keep all my albums if I can. Thanks!