JDBC connection problem - jdbc

i have created only one object for connection MYSQL database ... and i am trying to access it only one time but it is giving a exception like this
Could not able to connect database com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Too many connections
please help me out to this problem.

What is the value of the max_connections variable in your my.cnf file? Are there other users connecting to the same MySQL server?

Related

How to connect to an Oracle database with JDBC

I currently have a connection for MySQL database and connected as:
spring.datasource.url = jdbc:mysql://${mysql.service.host}:${mysql.service.port}/${mysql.service.database}
If I were to change the database and used Oracle database instead then how would the datasource URL change?
jdbc:oracle:thin:#//server:port/service
or
jdbc:oracle:thin:#//server:port:SID
The server entry would be the IP address or network name where your Oracle Listener is handling connection requests. The port would be the port number being used for said listener requests.
Service would be the database service name, if you're connecting to an Oracle Pluggable Database, you'll always need this.
The SID is a unique ID for your database, you could use that, but you're encouraged to use the service instead.
If you wish to make a THICK connection, that is, use an Oracle Client to make a connection to your database, then things get a bit more complicated. I would suggest using THIN until you can't.

Informatica Domain Configuration database connection during Powercenter installation

I am trying to install Informatica Server.
During domain configuration repository database information I get database connectivity error.
Error: Test Connection Failed. Correct the database connection information and test the connection again.
But when I connect using same details through Oracle SQL Developer to this database, it works fine.
I am using service name and port number field from the TNS File, still getting this error.
I think you can check tomcat log, catalina.out logs. This will help on finding out real issue.
Go to command prompt and type ping localhost and see if its responding anything. May be you can use IP and check host file.

Umbraco database connection reach max pool size

Currently using version 7.13.2 with MySQL database.
When the usage in production server is high (with alot of concurrent user), Umbraco tend to create alot of database connection to handle those job. Those connection is not close after used but sleep.
Umbraco would continue to create more database connection when necessary until it reach the database max pool size.
Is this the intention behaviour by Umbraco? Else, how could we configure this issue?
After hundred hours of debugging, I finally found out the cause and the solution is easy.
This bug has nothing to do with Umbraco, it handles the connection perfectly. Umbraco using MySql Connector when connecting to MySql database. When the connection close, it is actually not close but instead, added to connection pool. Please refer to link below for more information.
MySql Connection not closing using .net MySql Connector
The solution as suggested from the link, just adding "Pooling=false" as a string parameter into connection string. The connection string locate inside the web config.
enter image description here

Database Link error ORA-12545: Connect failed because target host or object does not exist

I am currently accessing/connecting to a remote database through VPN and I have no issues querying on the remote database. I want to create a db-link to connect my local db to the remote database in order to join certain tables. Sadly, I am getting error ORA-12545.
This is my db-link code:
CREATE DATABASE LINK DB_LINK
CONNECT TO REMOTE_USER_NAME
IDENTIFIED BY PASSWORD
USING '(DESCRIPTION=(CONNECT_DATA=(SID=test_SID))(ADDRESS=(PROTOCOL=TCP)(HOST=HOST_NAME.com)(PORT=1521)))'
I don't have an Oracle client installed on my machine so I am using the full description. There are no issue accessing both our db and the remote db without an Oracle client installed so I assume this is not the problem.
My ping to the remote address returned TTL expired in transit even though the VPN is connected. This seems a bit weird but I am not entirely sure if this is the problem.
I must be missing a crucial step. Any advice is appreciated.

oracle weblogic - create new jdbc data source - connection test failed

I just installed oracle webligic 12.1.1, and I follow this videos's instructions:
youtube video
I write everything the same as in the video, when I wanted to test it, I got this exception:
Connection test failed.
IO exception: The Network Adapter could not establish the connection<br/>oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:458)
oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:546)
oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:236)
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521)
weblogic.jdbc.common.internal.DataSourceUtil.testConnection(DataSourceUtil.java:298)
com.bea.console.utils.jdbc.JDBCUtils.testConnection(JDBCUtils.java:746)
com.bea.console.actions.jdbc.datasources.createjdbcdatasource.CreateJDBCDataSource.testConnectionConfiguration(CreateJDBCDataSource.java:474)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.beehive.netui.pageflow.FlowController.invokeActionMethod(FlowController.java:870)
org.apache.beehive.netui.pageflow.FlowController.getActionMethodForward(FlowController.java:809)
org.apache.beehive.netui.pageflow.FlowController.internalExecute(FlowController.java:478)
org.apache.beehive.netui.pageflow.PageFlowController.internalExecute(PageFlowController.java:306)
org.apache.beehive.netui.pageflow.FlowController.execute(FlowController.java:336)
org.apache.beehive.netui.pageflow.internal.FlowControllerAction.execute(FlowControllerAction.java:52)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.beehive.netui.pageflow.PageFlowRequestProcessor.access$201(PageFlowRequestProcessor.java:97)
...
...
What could be the error, how could I solve it? Please, help me! Thank you!
Error: The Network Adapter could not establish the connection
The main cause of the above issue is the database is down or not pingable or not reachble...check your db services...make sure it is running fine.
First you have to create a DB, with MySQL or Oracle Database( SQLplus ), but that you already have done.
Then you have to go in your IDE (Eclipse or NetBeans) and select the option to see Services like Databases and Servers.
In Databases with right click (in Netbeans) you can see the option "new database connection", enter your credentials of the database that you already have created and this should resolve your problem if you are using NebBeans.
weblogic gives us many database options to choose. you have to make sure your database up and running before you try to connect. Just try to create a small DB table and query it by 'SELECT' option and check your DB is perfectly running. Connect giving your DB details correctly like name and type of DB. DERBY database is the inbuilt database provided in weblogic.
In my case, the error was in Weblogic 12.2.1.3.0.
I was creating a new datasource connection using a tnsnames that works perfectly fine in WL 12.1.3.
The fix was add more TRANSPORT_CONNECT_TIMEOUT (from 3 to 10) in the connection defined in the tnsnames, because apparently it wasn't enough for stablish a connection.
After that, the error was:
Blockquote
Could not establish a connection because of java.lang.IllegalArgumentException: ONS configuration failed
I solved this by putting this in setDomainEnv:
-Doracle.jdbc.fanEnabled=false

Resources