RE: DataNode connect to socket path?

From: Gentry, Michael (michael_gentr..anniemae.com)
Date: Tue Jul 20 2004 - 09:40:17 EDT

  • Next message: Andrus Adamchik: "Re: cayenne and eclipse pde"

    It's been a while since I've done low-level Unix stuff, but I believe
    that the Unix domain sockets are only available to the local host?
    Perhaps they'd work over a shared NFS file system, too, but that
    wouldn't be very snappy or secure (NFS uses UDP packets -- besides, we
    all know NFS stands for No F***ing Security). I don't know where your
    database server is located, but if it is on the same system that your
    application is running (which I'm guessing given the domain sockets),
    using localhost in your JDBC URL is fast and secure -- it doesn't go out
    over the network, it's a very fast local loopback mechanism.

    If it is not on the local system, there is probably a way to tunnel it
    through an SSL layer. I seem to remember a program called "stunnel",
    although I'm sure there are alternatives solutions, which would allow
    you to do that (Google is your friend). Of course, encrypting the
    connection would slow things down a tad.

    /dev/mrg

    -----Original Message-----
    From: Twan Kogels [mailto:twa..wansoft.com]
    Sent: Tuesday, July 20, 2004 3:46 AM
    To: cayenne-use..bjectstyle.org
    Subject: Re: DataNode connect to socket path?

    Hello Andrus,

    Thanks for the reply. I contacted the system admin and he wasn't very
    happy
    about it ;-) It seems that doing it over tcp/ip is slower and more
    insecure, but he will config it. We also have postgresql running, would
    this be a better choice for a production environment?

    Twan

    At 23:05 16-7-2004, you wrote:
    >Hi Twan,
    >
    > From Connector/J docs
    >(http://dev.mysql.com/doc/connector/j/en/index.html):
    >
    >"MySQL Connector/J can only communicate with MySQL using TCP/IP, as
    >Java does not support Unix domain sockets."
    >
    >So it seems like you are out of luck, since "Java doesn't support it".
    >But hey, nothing prevents you from continuing to use a regular
    >connection URL like jdbc:mysql://localhost/...
    >
    >Andrus
    >
    >
    >On Jul 16, 2004, at 4:06 AM, Twan Kogels wrote:
    >>Hi there,
    >>
    >>I'm at the point where i can deploy my webapplication to a production
    >>server. But i have a problem with the connection string i use to
    >>connect to the mysql database.
    >>
    >>On the test server this is:
    >>======================
    >><driver project-version="1.1" class="com.mysql.jdbc.Driver">
    >> <url value="jdbc:mysql://p400/proj"/>
    >> <connectionPool min="1" max="1" />
    >> <login userName="________" password="___________"/>
    >></driver>
    >>======================
    >>
    >>On the production server i need to connect to a socket on the local
    >>file system:
    >>======================
    >><driver project-version="1.1" class="com.mysql.jdbc.Driver">
    >> <url
    >> value="jdbc:mysql://localhost:/var/run/mysqld/mysqld.sock/proj"/>
    >> <connectionPool min="1" max="1" />
    >> <login userName="______" password="_________"/>
    >></driver>
    >>======================
    >>
    >>This gives me a:
    >>======================
    >>javax.servlet.ServletException: [v.1.1M7_1 June 15 2004] Global
    >>exception.
    >> at
    >>org.apache.struts.action.RequestProcessor.processException(RequestProc
    e
    >>ssor.java:545)
    >> at
    >>org.apache.struts.action.RequestProcessor.processActionPerform(Request
    P
    >>rocessor.java:486)
    >> at
    >>org.apache.struts.action.RequestProcessor.process(RequestProcessor.jav
    a :274)
    >> at
    >>org.apache.struts.action.ActionServlet.process(ActionServlet.java:
    1482)
    >> at
    >>org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
    >>
    >>org.objectstyle.cayenne.CayenneRuntimeException: [v.1.1M7_1 June 15
    >>2004] Global exception.
    >> at
    >>org.objectstyle.cayenne.access.util.SelectObserver.nextGlobalException
    (
    >>SelectObserver.java:214)
    >> at
    >>org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:
    322)
    >> at
    >>org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.ja
    v
    >>a:654)
    >> at
    >>org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.
    j
    >>ava:1325)
    >> at
    >>org.objectstyle.cayenne.access.Transaction.performQueries(Transaction.
    j
    >>ava:176)
    >> at
    >>org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.
    j
    >>ava:1284)
    >> at
    >>org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.ja
    v
    >>a:1499)
    >>
    >>Caused by: java.sql.SQLException: Cannot load connection class because
    >>of underlying exception: 'java.lang.NumberFormatException: For input
    >>string: "/"'.
    >> at
    >>com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:
    355)
    >> at
    >>org.objectstyle.cayenne.conn.DriverDataSource.getConnection(DriverData
    S
    >>ource.java:151)
    >> at
    >>org.objectstyle.cayenne.conn.PooledConnectionImpl.reconnect(PooledConn
    e
    >>ctionImpl.java:126)
    >> at
    >>org.objectstyle.cayenne.conn.PooledConnectionImpl.getConnection(Pooled
    C
    >>onnectionImpl.java:163)
    >> at
    >>org.objectstyle.cayenne.conn.PoolManager.getConnection(PoolManager.jav
    a :434)
    >> at
    >>org.objectstyle.cayenne.conn.PoolManager.getConnection(PoolManager.jav
    a :385)
    >>======================
    >>
    >>In PHP i always use:
    >>======================
    >>$db = mysql_pconnect ("localhost:/var/run/mysqld/mysqld.sock",
    >>"_______", "___________");
    >>======================
    >>
    >>I can't seem to figure out on how to specify a path to a socket in the
    >>"DataNode.driver.xml". Maybe i'm searching for the wrong thing but
    >>google didn't find the answer too.
    >>
    >>Does anybody know a solution to this problem?
    >>
    >>Cheers,
    >>Twan Kogels
    >>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Tue Jul 20 2004 - 09:40:26 EDT