Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

Failed to connect to database URL

Help
Rajeesh T
2010-05-18
2013-05-29
  • Rajeesh T
    Rajeesh T
    2010-05-18

    Hi

    When I configure schemaspy in linux+mysql server I am getting following error

      /net/sourceforge/schemaspy/dbTypes/mysql.properties

    Failed to connect to database URL

    com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

    ** BEGIN NESTED EXCEPTION **

    java.net.UnknownHostException
    MESSAGE: <10.245.215.241>

    STACKTRACE:

    java.net.UnknownHostException: <10.245.215.241>
       at java.net.ResolverCache.getHostByName(libgcj.so.8rh)
       at java.net.InetAddress.getAllByName(libgcj.so.8rh)
       at com.mysql.jdbc.StandardSocketFactory.connect(mysql-connector-java-3.1.12.jar.so)
       at com.mysql.jdbc.MysqlIO.<init>(mysql-connector-java-3.1.12.jar.so)
       at com.mysql.jdbc.Connection.createNewIO(mysql-connector-java-3.1.12.jar.so)
       at com.mysql.jdbc.Connection.<init>(mysql-connector-java-3.1.12.jar.so)
       at com.mysql.jdbc.NonRegisteringDriver.connect(mysql-connector-java-3.1.12.jar.so)
       at net.sourceforge.schemaspy.SchemaAnalyzer.getConnection(SchemaAnalyzer.java:481)
       at net.sourceforge.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:114)
       at net.sourceforge.schemaspy.Main.main(Main.java:21)

    ** END NESTED EXCEPTION **

    Last packet sent to the server was 84 ms ago.
       at com.mysql.jdbc.Connection.createNewIO(mysql-connector-java-3.1.12.jar.so)
       at com.mysql.jdbc.Connection.<init>(mysql-connector-java-3.1.12.jar.so)
       at com.mysql.jdbc.NonRegisteringDriver.connect(mysql-connector-java-3.1.12.jar.so)
       at net.sourceforge.schemaspy.SchemaAnalyzer.getConnection(SchemaAnalyzer.java:481)
       at net.sourceforge.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:114)
       at net.sourceforge.schemaspy.Main.main(Main.java:21)

    I am running the following command in console point
    java -jar schemaSpy_4.1.1.jar -t mysql -cp /usr/share/java/mysql-connector-java.jar -host 10.245.215.241 -port 3306 -db test -u testdb -p test123 -s testdb -o /var/ww/html/spy

    version of java is java version "1.5.0"

    Please help me..I am so disappointed…plz…

     
  • John Currier
    John Currier
    2010-05-18

    It's extremely strange that your connection string has <>'s in it.  Can you try the latest beta version and see if that resolves the issue?

    John

     

  • Anonymous
    2011-03-10

    I have the same error message but for a different reason. The echo looks like the login was unsuccessful, but looking at the destination database (salesforce) I can see that the login WAS successful from this machine and API. Very strange. Here's the output from the ant build:

    C:\Program Files\SchemaSpy>ant
    Buildfile: C:\Program Files\SchemaSpy\build.xml
    document:
         [echo] Generating SchemaSpy documentation (requires Graphviz to be installed to produce diagrams)
       [delete] Deleting directory C:\Program Files\SchemaSpy\doc
         [java] Using database properties:
         [java]   C:\Program Files\SchemaSpy\schemaspy\force.properties
         [java] 16:36:24.002 VARNING: JavaUtils.isAttachmentSupported - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
         [java] ForceMetaDataDriver: Force.com connection url https://www.salesforce.com/services/Soap/u/18.0
         [java] ForceMetaDataDriver: Filter [exclusionNames=[user], inclusionNames=[], keepCustom=true, keepStandard=false]
         [java]
         [java] Failed to connect to database URL [jdbc:claimvantage:force:MY-USERNAME:PASSWORD-WITH-SECURITy-CODE]
         [java]
         [java] java.sql.SQLException: java.lang.NullPointerException
         [java]     at com.claimvantage.force.jdbc.Filter.accept(Filter.java:59)
         [java]     at com.claimvantage.force.jdbc.Service.keep(Service.java:241)
         [java]     at com.claimvantage.force.jdbc.Service.getSObjectTypes(Service.java:230)
         [java]     at com.claimvantage.force.jdbc.Service.createResultSetFactory(Service.java:70)
         [java]     at com.claimvantage.force.jdbc.ForceMetaDataDriver.connect(ForceMetaDataDriver.java:41)
         [java]     at net.sourceforge.schemaspy.SchemaAnalyzer.getConnection(SchemaAnalyzer.java:582)
         [java]     at net.sourceforge.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:157)
         [java]     at net.sourceforge.schemaspy.Main.main(Main.java:42)
         [java]
         [java]     at com.claimvantage.force.jdbc.ForceMetaDataDriver.connect(ForceMetaDataDriver.java:45)
         [java]     at net.sourceforge.schemaspy.SchemaAnalyzer.getConnection(SchemaAnalyzer.java:582)
         [java]     at net.sourceforge.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:157)
         [java]     at net.sourceforge.schemaspy.Main.main(Main.java:42)
    BUILD FAILED
    

    Any ideas?

     
  • John Currier
    John Currier
    2011-03-10

    You'd have better luck asking the driver developer, but if this version of Filter is what you're running then all I can say is that either sob is null or sob.getName() returned null.  I couldn't track back through the code far enough to figure out where the null could have been introduced.

    John

     
  • John Orr
    John Orr
    2011-08-09

    Found this post due to similar symptoms (though it's highly likely I'm doing other things wrong).  Since I too have angle brackets in my connection string, I tried the latest beta version, and got the same result.  Figured I might as well post the results here for your reference.  I'm on an older debian system (lenny).

    #: john@zeno:~/tasks/pkg/tirtlnet ; java -jar /home/john/schemaSpy.jar -cp /usr/share/java/mysql-connector-java.jar -t mysql -o schemaspy -host localhost -db tirtlnet_v2 -u root
    Using database properties:
      [/home/john/schemaSpy.jar]/net/sourceforge/schemaspy/dbTypes/mysql.properties
    Failed to connect to database URL [jdbc:mysql://<localhost>/<tirtlnet_v2>]
    com.mysql.jdbc.CommunicationsException: Communications link failure
    Last packet sent to the server was 1 ms ago.
       at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1070)
       at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2103)
       at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:718)
       at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:298)
       at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
       at net.sourceforge.schemaspy.SchemaAnalyzer.getConnection(SchemaAnalyzer.java:574)
       at net.sourceforge.schemaspy.SchemaAnalyzer.analyze(SchemaAnalyzer.java:154)
       at net.sourceforge.schemaspy.Main.main(Main.java:45)
    Caused by: java.net.UnknownHostException: <localhost>
       at java.net.ResolverCache.getHostByName(libgcj.so.90)
       at java.net.InetAddress.getAllByName(libgcj.so.90)
       at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:244)
       at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:281)
       at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2029)
       ...6 more
    #: john@zeno:~/tasks/pkg/tirtlnet ;
    
     
  • John Currier
    John Currier
    2011-08-09

    I don't understand how it can be keeping the <>'s.  Are you using an unusual version of Java or something?  It just doesn't make sense.

    John

     
  • John Orr
    John Orr
    2011-08-10

    Thanks for the prompt reply John.

    As far as I know the machine has not been used to run any home-brewed java code, so I'd expect all packages to be fairly standard Debian Lenny installations.  Here's the list, in case it helps.  The base java package, java-common, is as per the Debian package listing for Lenny.

    #: john@zeno:~ ; dpkg -l | grep -i java
    ii  astyle                                                  1.22-1                      Source code indenter for C++/C/Java/C# source code
    ii  bsh                                                     2.0b4-8                     Java scripting environment (BeanShell) Version 2
    ii  bsh-gcj                                                 2.0b4-8                     Java scripting environment (BeanShell) Version 2 (native code)
    ii  gcj                                                     4:4.3.2-2                   The GNU Java compiler
    ii  gcj-4.1                                                 4.1.1-20                    The GNU compiler for Java(TM)
    ii  gcj-4.3                                                 4.3.2-2                     The GNU compiler for Java(TM)
    ii  gij                                                     4:4.3.2-2                   The GNU Java bytecode interpreter
    ii  gij-4.1                                                 4.1.1-20                    The GNU Java bytecode interpreter
    ii  gij-4.3                                                 4.3.2-2                     The GNU Java bytecode interpreter
    ii  java-common                                             0.30                        Base of all Java packages
    ii  java-gcj-compat                                         1.0.78-2                    Java runtime environment using GIJ
    ii  java-gcj-compat-headless                                1.0.78-2                    Java runtime environment using GIJ (headless version)
    ii  libbcel-java                                            5.2-3                       Analyze, create, and manipulate (binary) Java class files
    ii  libecj-java                                             3.3.0+0728-9                Eclipse Java compiler (library)
    ii  libgcj-common                                           1:4.3.2-2                   Java runtime library (common files)
    ii  libgcj7-0                                               4.1.1-20                    Java runtime library for use with gcj
    ii  libgcj7-dev                                             4.1.1-20                    Java development headers and static library for use with gcj
    ii  libgcj7-jar                                             4.1.1-20                    Java runtime library for use with gcj (jar files)
    ii  libgcj9-0                                               4.3.2-2                     Java runtime library for use with gcj
    ii  libgcj9-dev                                             4.3.2-2                     Java development headers for use with gcj
    ii  libgcj9-jar                                             4.3.2-2                     Java runtime library for use with gcj (jar files)
    ii  libhsqldb-java                                          1.8.0.9-3                   Java SQL database engine
    ii  libhsqldb-java-gcj                                      1.8.0.9-3                   Java SQL database engine (native code)
    ii  libjaxp1.3-java                                         1.3.04-3                    Java XML parser and transformer APIs (DOM, SAX, JAXP, TrAX)
    ii  libjaxp1.3-java-gcj                                     1.3.04-3                    Java XML parser and transformer APIs (DOM, SAX, JAXP, TrAX)
    ii  libjline-java                                           0.9.94-1                    Java library for handling console input
    ii  libjs-jquery                                            1.2.6-2                     JavaScript library for dynamic web applications
    ii  libjs-prototype                                         1.6.0.2-4                   JavaScript Framework for dynamic web applications
    ii  libjson-perl                                            2.07-1                      Perl module to parse and convert to JSON (JavaScript Object Nota
    ii  liblog4j1.2-java                                        1.2.15-4                    Logging library for java
    rc  libmozjs0d                                              1.8.0.15~pre080614i-0etch1  The Mozilla SpiderMonkey JavaScript library
    ii  libmozjs1d                                              1.9.0.19-9                  The Mozilla SpiderMonkey JavaScript library
    ii  libmx4j-java                                            3.0.2-4                     An open source implementation of the JMX(TM) technology
    ii  libmysql-java                                           5.1.6+dfsg-1                Java database (JDBC) driver for MySQL
    ii  libregexp-java                                          1.4-5                       regular expression library for Java
    ii  libservlet2.4-java                                      5.0.30-8                    Servlet 2.4 and JSP 2.0 Java classes and documentation
    ii  libxalan2-java                                          2.7.1-2                     XSL Transformations (XSLT) processor in Java
    ii  libxalan2-java-gcj                                      2.7.1-2                     XSL Transformations (XSLT) processor in Java (native code)
    ii  libxerces2-java                                         2.9.1-2+lenny1              Validating XML parser for Java with DOM level 3 support
    ii  libxerces2-java-gcj                                     2.9.1-2+lenny1              Validating XML parser for Java with DOM level 3 support (native 
    ii  openoffice.org-gcj                                      1:2.4.1+dfsg-1+lenny11      OpenOffice.orgs Java libraries (native for use with GIJ)
    ii  openoffice.org-java-common                              1:2.4.1+dfsg-1+lenny11      OpenOffice.org office suite Java support arch. independent files
    #: john@zeno:~ ;
    

    I wondered if my /etc/hosts file might be unusual, and somehow causing problems - it contains the following:

    #: john@zeno:~/tasks/pkg/tirtlnet ; cat /etc/hosts
    127.0.0.1       localhost
    127.0.1.1       zeno.company.com.au        zeno
    # The following lines are desirable for IPv6 capable hosts
    ::1     ip6-localhost ip6-loopback
    fe00::0 ip6-localnet
    ff00::0 ip6-mcastprefix
    ff02::1 ip6-allnodes
    ff02::2 ip6-allrouters
    ff02::3 ip6-allhosts
    192.168.0.70    rabbit
    172.20.0.2      yirtl
    #: john@zeno:~/tasks/pkg/tirtlnet ;
    

    Looking at an strace of the execution, the first reference to <localhost> does happen soon after reading /etc/hosts (which may well mean nothing, but just in case):

    10784      0.000081 stat64("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=58, ...}) = 0
    10784      0.000140 open("/etc/hosts", O_RDONLY|O_CLOEXEC)                  = 13
    10784      0.000083 fstat64(13, {st_mode=S_IFREG|0644, st_size=294, ...})   = 0
    10784      0.000095 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb44ef000
    10784      0.000071 read(13, "127.0.0.1\tlocalhost\n127.0.1.1\tzeno.ceos.com.au\tzeno\n\n# The following lines are desirable for IPv6 capable hosts\n::1     ip6-localhost ip6-loopback\nfe00::0 ip6-localnet\nff00::0 ip6-mcastprefix\nff02::1 ip6-allnodes\nff02::2 ip6-allrouters\nff02::3 ip6-allhosts\n"..., 4096) = 294
    10784      0.000197 read(13, ""..., 4096)                                   = 0
    10784      0.000065 close(13)                                               = 0
    10784      0.000065 munmap(0xb44ef000, 4096)                                = 0
    10784      0.000084 stat64("/etc/resolv.conf", {st_mode=S_IFREG|0644, st_size=58, ...}) = 0
    10784      0.000135 socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)                 = 13
    10784      0.000074 connect(13, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.0.0.1")}, 28) = 0
    10784      0.000078 fcntl64(13, F_GETFL)                                    = 0x2 (flags O_RDWR)
    10784      0.000061 fcntl64(13, F_SETFL, O_RDWR|O_NONBLOCK)                 = 0
    10784      0.000059 gettimeofday({1312945979, 561763}, NULL)                = 0
    10784      0.000062 poll([{fd=13, events=POLLOUT}], 1, 0)                   = 1 ([{fd=13, revents=POLLOUT}])
    10784      0.000078 send(13, "\r\337\1\0\0\1\0\0\0\0\0\0\v<localhost>\4company\3com\2au\0\0\1\0\1"..., 41, MSG_NOSIGNAL) = 41
    

    Any suggestions for how to proceed, given I'm not the only to have seen this issue?

    Thanks very much,
    John

     
  • John Currier
    John Currier
    2011-08-12

    I've added some additional diagnostics to the latest beta.  If you run it with -loglevel fine you should see a ton of output that will include lines for database-specific options. The line of interest should look like this:

    12:42:08.877 FINE:    ConnectionURLBuilder.buildUrl - DbSpecificOption name: 'host' value: 'localhost' description: 'hostname[:port] host where database resides with optional port'
    

    localhost should not include <>s.  The resultant connectionURL also should not include <>s.  If either does then that should help narrow down where they're getting messed up.

    Thanks,
    John