• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

Connecting to another mysql database from within jForum.

 
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I link to jForum from within an application for which a user has already been validated. I include a session ID in the query string on the URL that links to jForum. This session ID is taken from the query string in CookieUserSSO.java and is used to select user data from my database, which is separate from jForum's. This all works OK on my test system using MySQL 5.0.38, but it fails on my new web hosting configuration. The failure comes when I try to connect to my separate database.

My hosting provider is looking into this, but I was wondering if any jForum experts out there may have a suggestion about where to look? There must be some configuration difference between the two MySQL implementations, mine and my web hosting company's.

Grabbing at straws, I wonder if this may be associated with connection pooling. For example my version of jForum uses connection pooling, but my connecting back to my database does its work outside of any jForum database processes. That is, I just use a simple JDBC driver

databaseConnection = Drivemanager.getConnection("jdbc:mysql://...", properties);

statement in CookieUserSSO.java.

Does anyone know if there is a problem opening a separate database from jForum's in this manner?

If I spark an interest in this forum and my host's support is not forthcoming, I can provide more information about their configuration.

Thanks,

Danny
[originally posted on jforum.net by dhhoyle]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The exception says

java.net.ConnectException: Connection refused

so for sure your mysql server is not accepting connections from the server JForum is hosted (or something else with the mysql configration is wrong, like the port)

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To supplement my original post, the error trace is included below. I am using jForum 2.1.7.

Thanks,

Danny

----------------------------------------------
08:48:58,756 INFO [AbstractPoolBackedDataSource] Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 120000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1567e6c, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1567e6c, idleConnectionTestPeriod -> 3600, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://dc2-mysql-02.kattare.com:3306/hs_jforum?user=dhhoyle&password=<my MySQL database passowrd>&autoReconnect=true&useNewIO=false&zeroDateTimeBehavior=convertToNull&useServerPrepStmts=false&dumpQueriesOnException=true&jdbcCompliantTruncation=false, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 10, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 5, numHelperThreads -> 3, preferredTestQuery -> null, properties -> {}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 180, usesTraditionalReflectiveProxies -> false ]
08:48:59,286 INFO [ConfigLoader ] Loading clickstream config from /home3/d/dhhoyle/public_html-webapps/servlets-examples/WEB-INF/config/clickstream-jforum.xml
08:48:59,351 ERROR [CookieUserSSO ] Exception opening hs_membersalive database:com.mysql.jdbc.CommunicationsException: Communications link failure due to underlying exception:

** BEGIN NESTED EXCEPTION **

java.net.SocketException
MESSAGE: java.net.ConnectException: Connection refused

STACKTRACE:

java.net.SocketException: java.net.ConnectException: Connection refused
at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:156)
at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:276)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2641)
at com.mysql.jdbc.Connection.<init>(Connection.java:1531)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:266)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at net.jforum.sso.CookieUserSSO.openDatabase(CookieUserSSO.java:109)
at net.jforum.sso.CookieUserSSO.getUserId(CookieUserSSO.java:179)
at net.jforum.sso.CookieUserSSO.authenticateUser(CookieUserSSO.java:48)
at net.jforum.ControllerUtils.checkSSO(ControllerUtils.java:226)
at net.jforum.ControllerUtils.refreshSession(ControllerUtils.java:288)
at net.jforum.JForum.service(JForum.java:158)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at net.jforum.util.legacy.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:59)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)

at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)


** END NESTED EXCEPTION **
[originally posted on jforum.net by dhhoyle]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rafael,
Since my code in CookieUserSSO uses a simple connection, I setup jForum to also use simple connections. I still got the same error.

My application updates jforum_users when a user registers or changes things like e-mail address and name. Opening a connection in my application to the jForum database, therefore, works OK. I always close connections after any database access; therefore, I do not have two connections open at the same time. See below.

I apologize for asking you to review my code, but I am stumped. I have attached my version of CookieUserSSO. Just a quick look would be appreciated to see if anything I am doing could confuse MySQL (MySQL connector 5.1.6). Actually, anything that violates some MySQL setup parameter For example, is it possible that jForum still has a connection open to its database, while I am trying to open a second database and my hosting provider's MySQL setup does not allow two database open at the same time? I will ask my web host if something like this is possible.

After I get the "Connection refused" error, jForum proceeds to signon a null user --something I need to stop eventually --, proving that jForum accesses its database OK.

Thanks very much,

Danny
[originally posted on jforum.net by dhhoyle]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, your dc2-mysql-02.kattare.com host must not being accepting connections from your machine.

Are you able to open a connection to that host with that user and password using the mysql command line tool?

Rafael

[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rafael,
I found my problem. Due to a mixup in links to jForum, I was merrily making changes to CookieUserSSO.java, but they were not seen by Tomcat and were not therefore recompiled. I was using an older version on my local Linux box, which happily opened my database connections with old user IDs and passwords. Moving to a web host required new user IDs and passwords, uncovering my error.

You were great to look at my ramblings. Your suggestions made me look deeper. When I finally compared .java and .class timesamps, I saw the problem.

Muito obrigado,

Daniel
[originally posted on jforum.net by dhhoyle]
 
reply
    Bookmark Topic Watch Topic
  • New Topic