I have a database on external server with Cpanel. I've made database and all I know is that this is database adress: server: pgsql1.superhost.pl
I tried to connect like this:
connection = DriverManager.getConnection(
"jdbc:postgresql://sql1.superhost.pl:5432/database_name",
"user_name", "password");
I tried without port, I tried everything, but I'm still getting error:
org.postgresql.util.PSQLException: at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:233)
....
Caused by: java.net.UnknownHostException: sql1.superhost.pl
Related
I wish to use Hikari Connection Pool in my Spring application to connect to the Oracle Database
Below is the connection string
JDBC URL:
jdbc:oracle:thin:#ldaps://abc-def-dmz.demo.com:876/SOM_APP,cn=oraclecontext,dc=demo,dc=com
Getting the following error
Error Message: Failed to initialize pool: IO Error: JNDI Package
failure javax.naming.CommunicationException: localhost:876[Root
exception is java.net.ConnectException: Connection refused: connect]
How do I fix this?
java.net.ConnectException: Connection refused: connect
The error implies that your connection is being blocked, most likely by a firewall. Check with your DBA and system or network administrators to make sure the network path to the server is open, and that you are using the right port numbers.
I have a pretty simple commandline app that runs inside of eclipse that connects to an Oracle 12 database and issues a pretty simple query. I'm getting the following exception:
Exception in thread "main" org.javalite.activejdbc.InitException: Failed to connect to JDBC URL: jdbc:oracle:thin:#oratest2a.emspic.org:1521:workstst
at org.javalite.activejdbc.DB.open(DB.java:93)
at org.javalite.activejdbc.Base.open(Base.java:64)
at org.emspic.works.RegistrationUtil.doMain(RegistrationUtil.java:135)
at org.emspic.works.RegistrationUtil.main(RegistrationUtil.java:75)
Caused by: java.sql.SQLRecoverableException: IO Error: Connection reset by peer: socket write error
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:752)
at oracle.jdbc.driver.PhysicalConnection.connect(PhysicalConnection.java:666)
Code throwing the exception is basically this:
// use properties to open the datasource for work
System.out.println("Opening database connection.");
logger.info("Opening database");
String dbDriver = dbProps.get("dbDriver");
String dbURL = dbProps.get("dbURL");
String username = dbProps.get("username");
String password = dbProps.get("password");
Base.open(dbDriver, dbURL, username, password);
logger.info("Database successfully opened.");
Everything I've googled indicates the problem is a "network issue"...except that on this same machine, I am currently connected to the very table I'm trying to open via TOAD...and I also am running a jboss as server connecting to that very same database...so there is no way it is a network problem.
I'm at a total loss.
Java1.8, ojdbc7.jar, all running on a Microsoft Surface Pro 3..., Oracle version is 12.0.2 running remotely.
Your exception has nothing to do with AcitveJDBC. There is a problem with your Oracle configuration. I bet you will get the same exception if you try just JDBC with the same parameters. When/if you fix your issue with JDBC, ActiveJDBC will work just fine.
I am able to connect to database using PL/SQL developer.
But, when I am not able to connect to database using DriverManager.getConnection(databaseUrl, idUser, password);
I am getting this error
java.sql.SQLException: Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:673)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:715)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:385)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:564)
at java.sql.DriverManager.getConnection(DriverManager.java:571)
I am not able to connect to oracle Database from my machine , but can connect to same DB through SQL developer. I am getting the following exception
java.sql.SQLRecoverableException: IO Error: Connection reset by peer:
socket write error at
oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:428) at
oracle.jdbc.driver.PhysicalConnection.(PhysicalConnection.java:536)
at oracle.jdbc.driver.T4CConnection.(T4CConnection.java:228)
at
oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:521) at
oracle.jdbc.pool.OracleDataSource.getPhysicalConnection(OracleDataSource.java:280)
at
oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:207)
at
oracle.jdbc.pool.OracleDataSource.getConnection(OracleDataSource.java:157)
at OrgHierarchy.DBTest.main(DBTest.java:39)
I can also telnet to same DB URL and port.
Other Details: Windows XP , Oracle 11g 11.0.2
thanks.
I am trying to connect to a msql server using jtds driver
my connection string is like this
jdbc:jtds:sqlserver://10.0.0.44:1433/foodserv;TDS=8.0
but if i change it to
jdbc:jtds:sqlserver://jagath-pc:1433/foodserv;TDS=8.0
Then it do not connect and gives SQLexception
Using the same name when i am connecting using my PC it is connecting OK, means there is no
conflict with the server name
i get exception like this
java.sql.SQLException: Unknown server host name 'Unable to resolve host "jagath-pc":
No address associated with hostname'.