Help Connecting an elevator to an Oracle database

So, I have something like this in my boot.scala:

object DBVendor extends ConnectionManager {
 def newConnection(name: ConnectionIdentifier): Box[Connection] = {
   try {
     Class.forName("oracle.jdbc.driver.OracleDriver")
     val dm = DriverManager.getConnection("jdbc:oracle:thin:@hostname:1521:orcl", "username", "password");

     Full(dm)
   } catch {
     case e : Exception => e.printStackTrace; Empty
   }
 }
 def releaseConnection(conn: Connection) {conn.close}
}

A few quick questions I have ... How do I configure a driver to connect?

@hostname from what I see is for local databases, but my remote ... I have all the information to connect to it through the sqldeveloper that I use, and assumed that all I need is a host name. Is the hostname all I need there, if that's all I need? or will I need some kind of absolute address?

+3
source share
3 answers

, , ( ), , .

oracle jdbc Java. downloads.oracle.com

0

" " IP- ( , IP-, "ping hostname" ).

JDBC

% %/src/main/webapp/WEB-INF/lib

, lib. Oracle, :

% oracle%/jdbc/lib

0

@hostname , . IP- . IP- . @hostname " ". , , @localhost . orcl . ​​ .

: http://www.java-tips.org/other-api-tips/jdbc/how-to-connect-oracle-server-using-jdbc-4.html

0

Source: https://habr.com/ru/post/1748595/


All Articles