How to connect to oracle9i database from Unix

Hi All,
How can i connect to remote oracle9i database(windows based) from Unix. I have following server information Server IP, Username , Userpassword , DataBase name.Do i need any other information to connect to server?
How can i connect database from Putty?
Do i need to install SQL on the Unix to connect to oracle server?
and which C/C++ API i have to use to access tables from the remote oracle server?
please help me i am new to oracle .
Thanks in advance.

Oracle generally uses a special set of software, commonly called the SQLNet or Oracle Networking, as a layer to provide a connection between the client and the database server.
In general terms,
- the client software (perhaps sqlplus, an application, ODBC) calls Oracle Networking on the client computer and says "please connect to database known as 'x'";
- Oracle Networking translates the request, often by looking up 'x' in the TNSNAMES.ORA file at the client side, to get the host name, the port the Oracle listener is waiting on, and the name of the database service to access;
- Oracle Networking contacts the computer on the required port. If the listener is there, the Oracle Networking client asks for a connection to the database service;
- The Listener (if it recognizes it) asks the database service for a 'server process';
- The database starts up a server process which grabs a network port and tells the listener which port was obtained;
- The listener tells Oracle Networking on the client which port to use;
- The client disconnects from the Listener, and reconnects at that port;
- The server process starts authentication and session initialization, after which we are good to go.
In answer to your questions:
1) How can i connect database from Putty?
That implies you want to telnet to the Windows box and run the client stuff locally on the Windows box. So that means you need to look at telnet or ssh documentation - this has nothing to do with Oracle.
2) Do i need to install SQL on the Unix to connect to oracle server?
Not really. It does mean you might want to install an Oracle CLIENT (see the download section of http://otn.oracle.com) which will initiate the sequence as above.
A different sort of client is SQL Developer, a Java-based GUI with it's own built-in Oracle Networking, that displays database stuff. That is also offered by Oracle at the same download page.
3) and which C/C++ API i have to use to access tables from the remote oracle server?
Oracle provides a C/C++ API as a pre-processor, called Pro*C. I suspect this si way beyond what you want right now.
4) please help me i am new to oracle .
Please, please, please, please, please ..... please .... purchase and read http://www.oreilly.com/catalog/oressentials3/

Similar Messages

  • How to connect to  Oracle database from webdynprojava application

    Hi
    How to connect to  Oracle database from webdynprojava application. where can we provide the code to connect to database.?
    Thank You.

    Hi,
    You need to create  Java Bean model. The bean is a typical java bean with default constructor, getter and setter. You can have additional methods for query etc. The attributes in the class will be your model node and attributes.
    However you need to configure the connection and create JNDI using visual administrator before writing the code.
    You can also consider writing Session EJB with oracle and using them in WD.
    http://help.sap.com/saphelp_nwce10/helpdata/en/45/dcaa4f05535591e10000000a1553f7/frameset.htm
    Srini

  • How to connect to oracle database from visual basic 2010 express edition

    I have installed visual basic 2010 express edition on windows xp. But visual basic 2010 express edition supports Microsoft sql server database file,Microsoft sql server compact 3.5, Microsoft access database file. I want to connect to oracle database from visual basic 2010 express edition. So what drivers are required and how to do connectivity?

    Hello,
    I wasn't clear on what you were using to make the connection. I had a look in Visual Studio 2010 (don't have express to test sorry).
    I think you mean the Data Sources available under the menu Data-> Datasources. this seems to match the description you give when I
    look at the list of datasource options.
    In here you can make ODBC connections via the Microsoft .net Data Provider .
    If you select ODBC as a datasource you can see listed the DSN's you created - for example I see 2 which use the Oracle ODBC driver.
    This assumes you installed an Oracle Client + the oracle version of the ODBC driver (comes with the oracle client).
    Once you created a server connection then you should see it in the server explorer.
    You can also download the Oracle Developer Tools for Visual Studio which is an add on for VS.
    ** I suspect this is only for VS 2010 and I didn't see that Express was supported.
    http://www.oracle.com/technetwork/developer-tools/visual-studio/overview/index-097110.html
    Let me know if that helps.
    John

  • How to connect to SAP Database from a Adobe flex application?

    Hi
    I am an intern currently working on designing an Adobe flex interface that interacts with an SAP Database, although im torn between methods of implementing the most efficient connection without over-complicating the problem. I believe the best approach would be to use SAPJCo but am unfamiliar with how to approach this method and am finding it hard to get detailed documentation or code examples which show connecting to a Database. Another approach would be using a web service but my problems again arise with my lack of knowledge to connect to the Database.
    Any advice or help would be much appreciated.
    Thanks,
    Jonny

    Hi Jonathan.
    I believe webservice is the best approach, steps to create webservice is very simple.
    1. create a webservice from a standard rfc or bapi.
    2. release and activate webservice.
    3. it will generate wsdl file which can be used in flex environment.
    creating webservice.
    http://help.sap.com/saphelp_nw04s/helpdata/en/0d/2eac5a56d7e345853fe9c935954ff1/frameset.htm
    Consuming ABAP Web Services using Flex :
    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/emtech/consuming%2babap%2bweb%2bservices%2busing%2bflex
    i hope this surely helps.
    Venkat.

  • Connecting to a Database from an IView ?

    I have to create an IView which retrieves data from an Oracle database and display it in a tabular format in a IView.Can anybody please tell me how to connect to a database from an IView, where to specify the connection parameters to connect to a database.
    Can anybody help in this regard, it is urgent.

    Go in Content Administration - Portal Content. Make in a Folder of your choice rightclick an select:
    "Neu - iView - Datenbank-JDBC-iView". Then follow the wizard.
    Best Regards,
    Patrick
    http://www.Unternehmensportale.biz

  • How can I connect to a database from ipaq with cldc??

    how can I connect to a database from ipaq with cldc??

    Hi Again
    There is a library by Mimer which allows you do connect to a Mimer SQL Server, don't know must about it, but here is a link.
    http://developer.mimer.com/
    If that doesn't suit you, I suspect that you will have to use some sort of proxy solution. Either by creating a servlet to accept the sql string you want to send, or by creating your own custom proxy server running J2EE. The servlet or the proxy server must be able to receive an SQL String, do the query to the actual database and return the results in some sort of format to the mobile device. Maybe just a space delimited string.
    Hope this helps
    -Daur

  • Who can explain how EJB connect to Oracle9i DB with DataSource?

    I have taken 4 days into this problem. I am developing EJB with J2EE1.3 and Oracle9i DB, I can connect to DB in code with DriverManager. But I want to use DataSource to connect to DB. I failed, I can not get new way to resolve it when I after try to connect with javax.sql.DataSource, oracle.jdbc.pool.OracleDataSource and oracle.jdbc.pool.OracleConnectionPoolDataSource.
    I have got different Exceptions when I coding different ways:
    one is:
    Caught an exception.
    java.rmi.ServerException: RemoteException occurred in server thread; nested exce
    ption is:
    java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: U
    nable to connect to database. com.sun.enterprise.resource.JdbcDataSource; nested
    exception is:
    javax.ejb.EJBException: Unable to connect to database. com.sun.enterpris
    e.resource.JdbcDataSource
    java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: Unable to
    connect to database. com.sun.enterprise.resource.JdbcDataSource; nested excepti
    on is:
    javax.ejb.EJBException: Unable to connect to database. com.sun.enterpris
    e.resource.JdbcDataSource
    javax.ejb.EJBException: Unable to connect to database. com.sun.enterprise.resour
    ce.JdbcDataSource
    <<no stack trace available>>
    the Other is:
    Caught an exception.
    java.rmi.ServerException: RemoteException occurred in server thread; nested exce
    ption is:
    java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: U
    nable to connect to database. makeConnection:Io Exception: Connection refused(DESCRIP
    TION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4)
    ))); nested exception is:
    javax.ejb.EJBException: Unable to connect to database. makeConnection:Io
    Exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_
    STACK=(ERROR=(CODE=12505)(EMFI=4))))
    java.rmi.RemoteException: nested exception is: javax.ejb.EJBException: Unable to
    connect to database. makeConnection:Io Exception: Connection refused(DESCRIPTION=(TM
    P=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4)))); nes
    ted exception is:
    javax.ejb.EJBException: Unable to connect to database. makeConnection:Io
    Exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_
    STACK=(ERROR=(CODE=12505)(EMFI=4))))
    javax.ejb.EJBException: Unable to connect to database. makeConnection:Io Exception: C
    onnection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(E
    RROR=(CODE=12505)(EMFI=4))))
    <<no stack trace available>>
    My codes related are:
    private void makeConnection() throws NamingException, SQLException {
    try{
    InitialContext ic = new InitialContext();
    OracleConnectionPoolDataSource ocpds = (OracleConnectionPoolDataSource) ic.lookup(dbName);
    PooledConnection pc = ocpds.getPooledConnection();
    con = pc.getConnection();
    }catch(SQLException ex){
    throw new SQLException("makeConnection:" + ex.getMessage());
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    con = DriverManager.getConnection(
    "jdbc:oracle:thin:@172.28.200.43:1521:shcd",
    "lijun", "xiaotian"); */
    public void setEntityContext(EntityContext context) {
    this.context = context;
    try {
    makeConnection();
    } catch (Exception ex) {
    throw new EJBException("Unable to connect to database. " +
    ex.getMessage());
    I believe I set JNDI and config EJB right, because I can run it with Cloudscape DB all right.
    who can tell me where is my WRONG, or tell me how to connect to Oracle9i DB?

    Hi Jhlijun,
    I am facing the same problem at the moment. However, I am not using a pooled connection. The following is my code. I am trying to connect a stateless session bean to an Oracle 9i database with result being fed back to a jsp page.
    package Test;
    import javax.naming.*;
    import java.sql.*;
    import java.util.*;
    import javax.ejb.*;
    import javax.sql.DataSource;
    import javax.sql.*;
    public class TestSessionEJBbean extends java.lang.Object implements javax.ejb.SessionBean
    String q="Select NAMETITLE,NAMEFIRST,NAMELAST from People where PeopleRSN<100";
         protected boolean create() throws java.lang.Exception
    return true;
    public TestSessionEJBbean()
    {   // EJB constructors don't have a server context.
    private void unhandledEvent( String listenerName, String methodName, java.lang.Object event )
    // method for interface javax.ejb.SessionBean
    public void ejbActivate() throws javax.ejb.EJBException, java.rmi.RemoteException
    // To Do
    // method for interface javax.ejb.SessionBean
    public void ejbPassivate() throws javax.ejb.EJBException, java.rmi.RemoteException
    // To Do
    // method for interface javax.ejb.SessionBean
    public void ejbRemove() throws javax.ejb.EJBException, java.rmi.RemoteException
    // To Do
    // method for interface javax.ejb.SessionBean
    public void setSessionContext( javax.ejb.SessionContext parm0 ) throws javax.ejb.EJBException, java.rmi.RemoteException
    this._sessionContext = parm0;          // generated helper code
    // To Do
    * Test Method
    public String Test() throws javax.ejb.EJBException
    return "Hi! I am the SessionEjbBean.";
    * Session Context of this EJB.
    * Set in 'setSessionContext()' before any 'ejbCreate()' is executed.
    private javax.ejb.SessionContext _sessionContext;
    * ejbCreate Method
    public void ejbCreate() throws javax.ejb.EJBException, javax.ejb.CreateException
    try {
    create(); // This 'create()' is used for internal initialization.
    catch( java.lang.Exception __e) {
    System.err.println( __e.toString() + " " + __e.getMessage() );
    // TODO: implement
    * getDBConnection Method
         public sun.jdbc.rowset.CachedRowSet getDBConnection() throws javax.ejb.EJBException
         String testPrint = "Starting...";//Only to check output
         Connection conn;
         sun.jdbc.rowset.CachedRowSet crset=null;
         try {
              testPrint += "before new InitialContext()....";//Only to check output
              InitialContext ic = new InitialContext();
              DataSource ds = (DataSource)ic.lookup("java:comp/env/jdbc/coquit");
              testPrint += "before ds.getConnection()....";//Only to check output
              conn = ds.getConnection("coquit","coquit");          
                   testPrint += "before conn.createStatement()....";
                   Statement stmt=conn.createStatement();
                   testPrint += "before stmt.executeQuery(....)";
                   ResultSet rset = stmt.executeQuery(q);
                   testPrint += "before new sun.jdbc.rowset.CachedRowSet()";     
                   crset = new sun.jdbc.rowset.CachedRowSet();
                   testPrint += "before crset.populate(rset)";
                   crset.populate(rset);
                   rset.close();
                   stmt.close();
                   conn.close();
         } catch (NamingException ne) {
         System.out.println("TestSessionEJBbean::getDBConnection Naming Exception " + ne);
         }catch (Exception e){
         System.out.println(testPrint+"...TestSessionEJBbean::getDBConnectionException" + e);
         System.out.println("\n\n");
         e.printStackTrace();
         return crset;

  • Topic: Who can explain how EJB connect to Oracle9i DB with DataSource?

    I have taken 4 days into this problem. I am developing EJB with
    J2EE1.3 and Oracle9i DB, I can connect to DB in code with
    DriverManager. But I want to use DataSource to connect to DB. I
    failed, I can not get new way to resolve it when I after try to
    connect with javax.sql.DataSource,
    oracle.jdbc.pool.OracleDataSource and
    oracle.jdbc.pool.OracleConnectionPoolDataSource.
    I have got different Exceptions when I coding different ways:
    one is:
    Caught an exception.
    java.rmi.ServerException: RemoteException occurred in server
    thread; nested exception is:
    java.rmi.RemoteException: nested exception is:
    javax.ejb.EJBException: Unable to connect to database.
    com.sun.enterprise.resource.JdbcDataSource; nested
    exception is:
    javax.ejb.EJBException: Unable to connect to database.
    com.sun.enterprise.resource.JdbcDataSource
    java.rmi.RemoteException: nested exception is:
    javax.ejb.EJBException: Unable to
    connect to database. com.sun.enterprise.resource.JdbcDataSource;
    nested exception is:
    javax.ejb.EJBException: Unable to connect to database.
    com.sun.enterprise.resource.JdbcDataSource
    javax.ejb.EJBException: Unable to connect to database.
    com.sun.enterprise.resource.JdbcDataSource
    <<no stack trace available>>
    the Other is:
    Caught an exception.
    java.rmi.ServerException: RemoteException occurred in server
    thread; nested exception is:
    java.rmi.RemoteException: nested exception is:
    javax.ejb.EJBException: Unable to connect to database.
    makeConnection:Io Exception: Connection refused(DESCRIPTION=
    (TMP=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=
    (CODE=12505)(EMFI=4)
    ))); nested exception is:
    javax.ejb.EJBException: Unable to connect to database.
    makeConnection:Io
    Exception: Connection refused(DESCRIPTION=(TMP=)
    (VSNNUM=150999297)(ERR=12505)(ERROR_
    STACK=(ERROR=(CODE=12505)(EMFI=4))))
    java.rmi.RemoteException: nested exception is:
    javax.ejb.EJBException: Unable to
    connect to database. makeConnection:Io Exception: Connection
    refused(DESCRIPTION=(TM
    P=)(VSNNUM=150999297)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)
    (EMFI=4)))); nested exception is:
    javax.ejb.EJBException: Unable to connect to database.
    makeConnection:Io
    Exception: Connection refused(DESCRIPTION=(TMP=)
    (VSNNUM=150999297)(ERR=12505)(ERROR_
    STACK=(ERROR=(CODE=12505)(EMFI=4))))
    javax.ejb.EJBException: Unable to connect to database.
    makeConnection:Io Exception: C
    onnection refused(DESCRIPTION=(TMP=)(VSNNUM=150999297)(ERR=12505)
    (ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
    <<no stack trace available>>
    My codes related are:
    private void makeConnection() throws NamingException,
    SQLException {
    try{
    InitialContext ic = new InitialContext();
    OracleConnectionPoolDataSource ocpds =
    (OracleConnectionPoolDataSource) ic.lookup(dbName);
    PooledConnection pc = ocpds.getPooledConnection();
    con = pc.getConnection();
    }catch(SQLException ex){
    throw new SQLException("makeConnection:" + ex.getMessage());
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    con = DriverManager.getConnection(
    "jdbc:oracle:thin:@172.28.200.43:1521:shcd",
    "lijun", "xiaotian"); */
    public void setEntityContext(EntityContext context) {
    this.context = context;
    try {
    makeConnection();
    } catch (Exception ex) {
    throw new EJBException("Unable to connect to database. " +
    ex.getMessage());
    I believe I set JNDI and config EJB right, because I can run it
    with Cloudscape DB all right.
    who can tell me where is my WRONG, or tell me how to connect to
    Oracle9i DB?

    Hi,
    on small thing to check (or perhaps do):
    Make sure that you are using the JDBC drivers from the Oracle9i
    DB client e.g. copy the classes12.jar from the ORACLE_HOME of
    the database client into OC4J_HOME lib.
    Also, one thing that might help is to define an explict Oracle
    datasource e.g.
    - Set class to value of Oracle DataSource class
    - Use only the location logical name
    - Returns Oracle implementation of java.sql.Connection
    <data-source
    class="oracle.jdbc.pool.OracleDataSource"
    name="jdbc/oracle/PooledDS"
    location="jdbc/oracle/PooledDS"
    username="scott"
    password="tiger"
    url="jdbc:oracle:thin:@<host>:<port>:<SID>"
    />
    Andy

  • I can't connect to MySQL database from The JSP Standard Tag Library

    Hi All !
    I have a problem, please help me anybody !
    I don't connect to MySQL database from jsp page using JSTL tag but from servlet all work correctly. I set my path and put �mysql-connector-java-3.1.13-bin.jar� in ENVIRONMENT WinXP(classpath=C:\Java\jdk1.5.0_10\jre\lib\ext\mysql-connector-java-3.1.13-bin.jar) and in War project folder �WEB-INF/lib� and in [TomcatServer]\common\lib.
    I have in folder�WEB-INF/lib� following files:
    antlr.jar
    commons-beanutils.jar
    commons-collections.jar
    commons-digester.jar
    commons-fileupload.jar
    commons-logging.jar
    commons-validator.jar
    jakarta-oro.jar
    jsf-api.jar
    jsf-impl.jar
    jstl.jar
    mysql-connector-java-3.1.13-bin.jar
    standard.jar
    struts.jar
    I'm using:
    NetBeans 5.5 Build200610171010 (bundled Tomcat 5.5.17)
    Ent.Pack 20061020 Visual Wb Pack 061103
    OS WinXP SP2
    Java 1.5.0_10
    MySQL 5.0.18-nt
    1:<%@page contentType="text/html"%>
    2:<%@page pageEncoding="UTF-8"%>
    8: <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    9: <%@taglib uri="http://java.sun.com/jstl/sql" prefix="sql"%>
    10:
    11: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    12: "http://www.w3.org/TR/html4/loose.dtd">
    13:
    14: <sql:setDataSource var="ds"
    15: driver="com.mysql.jdbc.Driver"
    16: url="jdbc:mysql://localhost:3306/test"
    17: user="root"
    18: password="xxxx"/>
    19:
    20:
    21:<sql:query sql="select name, age from People" var="res"
    22: dataSource="${ds}"/>
    I have received report on mistake when entered code at the top:
    �/index.jsp [21;0] According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions�
    I used instead of (dataSource="${ds}")->(dataSource="ds") but this did not work.
    After build and run I have received
    =========================================START=================================
    HTTP Status 500
    type Exception report:
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: /index.jsp(21,0) According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    root cause
    org.apache.jasper.JasperException: /index.jsp(21,0) According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146)
    org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:955)
    org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:710)
    org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1441)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
    org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213)
    org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219)
    org.apache.jasper.compiler.Node$Root.accept(Node.java:456)
    org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163)
    org.apache.jasper.compiler.Validator.validate(Validator.java:1489)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:166)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:276)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:264)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:303)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
    note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
    Apache Tomcat/5.5.17
    =======================================END================================
    Error: "According to TLD or attribute directive in tag file, attribute dataSource does not accept any expressions" - but according to documentation such parameter possible.
    BUT WHEN JOINING With DATABASE FROM SERVLET ALL WORK FINE.
    I read this doc - [http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html], this applicable if I Tomcat Admin, but i'am not Admin
    I simply user, i.e. I want to place its database on virtual host (Tomcat+(JSP-JSTL)+MySQL).
    There is idea how can resolve this problem
    Thank you in advance ;)

    For all how have similar problem.
    Decision instead of these ways
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    it is necessary to indicate these
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

  • Connecting to a database from another computer...

    hi guys!
    i just wonder if there is a simple way to connect to my database from another computer?
    do you have to change something in this method?
        private static Connection getConnection() {     Connection con = null;     try {         Class.forName("com.mysql.jdbc.Driver");         String url = "jdbc:mysql://localhost/Movies";         String user = "root";         String pw = "x";         con = DriverManager.getConnection(url, user, pw);         System.out.println("****Connected****");     }     catch (ClassNotFoundException e)     {         System.out.println(e.getMessage());           System.out.println("1");         System.exit(0);     }     catch (SQLException e) {         System.out.println(e.getMessage());           System.out.println("2");           System.exit(0);     }         return con;     }
    thanks! :)
    Edited by: Shaor-1 on Dec 22, 2008 3:47 AM

    hey!
    is there no one who knows how to do this?
    Here is my program that i want to change so it can connect to my mysql database but from another computer.
    import java.sql.*;
    import java.text.NumberFormat;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    public class ListMovies {
            static String exist = "existed";
        static int ye = 2221;
        static double pr = 21.12;
    public static void main (String[] args) throws InterruptedException {
    go();
    public static void go(){
           NumberFormat cf = NumberFormat.getCurrencyInstance();
        for(int i = 0; i < 1; i--){
        ResultSet movies = getMovies();
        try
            while (movies.next()){
                Movie m = getMovie(movies);
                String msg = Integer.toString(m.year);
                msg += ": " + m.title;
                msg += " (" + cf.format(m.price) + ")";
                System.out.println(msg);
              Thread.sleep(1000*10);
                catch (InterruptedException ex) {
                    Logger.getLogger(ListMovies.class.getName()).log(Level.SEVERE, null, ex);
                }    catch (SQLException e)
            System.out.println(e.getMessage());
    public static void loanMovie(String d) {
        Connection con = getConnection();
        try {
            Statement stmt = con.createStatement();
            String insert = "insert into movie "
                    + "(title, year, price) "
                    + "values ("
                    + "\"" + d + "\"" + ", "
                    + ye + ", " + pr +");";
            int i =stmt.executeUpdate(insert);
            if (i == 1){
                System.out.println("Loan recorded");
            else
                System.out.println("Loan not recorded");    
        catch (SQLException e){
            System.out.println(e.getMessage());
            System.out.println("CRAP"); 
    private static ResultSet getMovies()
        Connection con = getConnection();
        try {
            Statement s = con.createStatement();
            String select = "Select title, year, price " +
                    "from movie order by year";
            ResultSet rows;
            rows = s.executeQuery(select);
            return rows;
        catch (SQLException e)
            System.out.println(e.getMessage());
        return null;
        private static Connection getConnection() {
         Connection con = null;
         try {
             Class.forName("com.mysql.jdbc.Driver");
             String url = "jdbc:mysql://localhost/Movies";
             String user = "root";
             String pw = "x";
             con = DriverManager.getConnection(url, user, pw);
             System.out.println("****INFO****");
         catch (ClassNotFoundException e)
             System.out.println(e.getMessage());
               System.out.println("1");
             System.exit(0);
         catch (SQLException e) {
             System.out.println(e.getMessage());
               System.out.println("2");
              System.exit(0);
            return con;
        private static Movie getMovie(ResultSet movies) {
            try {
                String title = movies.getString("Title");
                int year = movies.getInt("Year");
                double price = movies.getDouble("price");
                return new Movie(title, year, price);
            catch (SQLException e)
            System.out.println(e.getMessage());   
            return null;
        private static class Movie
            public String title;
            public int year;
            public double price;
            public Movie(String title, int year, double price)
                this.title = title;
                this.year = year;
                this.price = price;
    BTW_
    my computers ip is: 81.229.40.17
    the database is on that computer.
    thanks!

  • Connecting to a database from Business Components JSP Application

    Hallo All!
    Can anybody give me an advice about connecting to a database from Business Components JSP Application? In all examples I see that Oracle user name and password placed in configuration file.
    How can user provide his own name and password to start Oracle session and how then hi can close this session?
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Dmitri:
    Dear Laura,
    I mean first variant where the database would be the same:
    scott/tiger@database1
    foo/bar@database1
    Of course I understand that we must register every user in database by "CREATE USER XXX" and it is unacceptable for Internet. But it may be very convenient for an Intranet because we can build access restriction based on set of views without any changes in applications.
    Best wishes,
    Dmitri.<HR></BLOCKQUOTE>
    null

  • Connection to Embeded Database from Crystal Reports XI

    I am writing an application that uses a SQL Server Mobile Database.  I have not been able to determine how to connect to this database through Crystal Reports.
    1.  Is it possible?
    2.  How do I provide the connection string that uses only 2 parameters?
    Gene

    When you create a DSN the ODBC string expects information for Server, Database, Username, and Password.  When you are working with an Embedded Database, typically you have a filename and a password (which can be null).  I was not able to create a DSN for this connection.
    What I have been able to get working is the following:
    1.  Create an ADO DataSet Object within the application.
    2,  Create the CR attaching ot the DataSet Object.
    3.  In the application code where you are attaching the CR to a viewer you must
          a.  Define a Data Adaptor for the DataSet.
          b.  Define a Data Table and load the table from the DataSet GetData() method.
          c.  Define the full path to the report file.
          d.  Define a ReportDocument Object
          e.  Load the report path in the the ReportDocument Object
          f.  Define the DataTable as the Data Source to the ReportDocument Object
          g. Define the Viewer ReportSource as the ReportDocument Object.
    I have been able to use this approach on 3 separate reports and returned the correct data.  A lot of steps, but it is working.
    GFKerls

  • How to connect to oracle10g Database using oracle11g Enterprise Manager.

    Hi,
    please suggest me how to connect to oracle10g Database using oracle11g Enterprise Manager.
    i did setting in tnsnames.ora file of oracle11g database but when i am trying to connect sys@testvsr and password
    using oracle11g Enterprise manager its not connecting but from command prompt its connecting.
    its not acccepting hostname its simply telling invalid username and password ,if i remove and try to connect its connecting.
    so please suggest its very urgent my manager is nagging.
    Regards,
    Srinu.

    you cant attach a database 10g instance with
    Enterprise manager of 11g as enterprise manager is
    meant for a single database only .. your problem cant be solved
    enterprise manager it can be solved by using GRID CONTROL
    For more details visit oracle documentation..
    Hope This helps..
    BI TC

  • How do connect to Historical Databases?

    Hi,
      please explain me what is Historical databases?
    Can u tell me how to connect to Historical databases? can we download these Database servers from net?
    - senthil

    Hi Senthil,
    You can try for RTXHDB (RTX Historical Database).
    RTX provide secured relational databases for LAN and WAN network.
    Often the use of relational database, or transaction-oriented technology, for off process historical LAN/WAN database applications, and doing unconventional operations on data.
    As an example,  It is in this area of off process historical data warehousing and retrieval that the RTXHDB (RTX Historical Database) system excels. RTXHDB processes and stores a massive flow of data for LAN/WAN database applications, which then can be retrieved with a great deal of speed and quickly turned into useful information for the PC user.
    You can check following links for more information.
    www.expertune.com/articles/isa2004perfmonhda.pdf
    http://www.rtx.com/hdbcncpt.htm
    Best Regards
    Ramshanker

  • How to delete string or line from unix file(dataset) of application server

    Hi  All,
    After transfer workarea information or all records into dataset(unix file). When I see the file in application server automatically the last line is shown a blank line. I am not passing any blank line.
    I have tried for single record than also the file generates the last line(2nd line) also a blank line.
    When I m reading the dataset, it is not reading the last blank line but why it is showing the last blank line?
    How to delete string or line from unix file(dataset) of application server?
    Please give your comments to resolve this.
    Thanks
    Tirumula Rao Chinni

    Hi Rio,
    I faced similar kind of issue working with files on UNIX platform.
    The line is a line feed to remove it use
    DATA : lv_carr_linefd TYPE abap_cr_lf VALUE cl_abap_char_utilities=>cr_lf. 
      DATA : lv_carr_return TYPE char1,                                   
             lv_line_feed   TYPE char1.                                          
      lv_line_feed   = lv_carr_linefd(1).
      lv_carr_return = lv_carr_linefd+1(1).
    Note: IMP: The character in ' ' is not space but is a special
    character set by pressing ALT and +255 simultaneosly
      REPLACE ALL OCCURRENCES OF lv_line_feed IN l_string WITH ' '.
      REPLACE ALL OCCURRENCES OF lv_carr_return IN l_string WITH ' '.

Maybe you are looking for