tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chun, Byung (GEAE, Elano)" <byung.c...@ae.ge.com>
Subject RE: Error with JDBC connecting from servlet
Date Tue, 18 Jul 2000 14:20:35 GMT
Dudley,
   assuming that the variable dbserver.somewhere.com is 
initialized elsewhere (i.e. from a properties file, or a
runtime argument, etc. ), your connection string in the 
code should look like:

	String strDBHost = dbserver.somewhere.com;
	String strConnectURL = "jdbc:oracle:thin@" + strDBHost +
				     ":1521:ORCL";

	_iobjConnection = DriverManager.getConnection(
					strConnectURL, this.get_isDBUserName(),
					this.get_isDBPassword() );

Since your using the default sid of ORCL, generally it is :

	jdbc:oracle:thin@<network machine name>:1521:ORCL

Cheers,

Jin

-----Original Message-----
From: Dudley Irish [mailto:dirish@arsmagna.com]
Sent: Monday, July 17, 2000 5:32 PM
To: tomcat-user@jakarta.apache.org
Subject: Re: Error with JDBC connecting from servlet


It means using something like the following to connect to the database
rather than getting the connection information from configuration
information.

   _iobjConnection = DriverManager.getConnection( new String(
"jdbc:oracle:thin:@(DESCRIPTION= (ADDRESS= (PROTOCOL = TCP)(HOST =
dbserver.somewhere.com)(PORT = 1521))(CONNECT_DATA = (SID = ORCL))  )" ),
this.get_isDBUserName(), this.get_isDBPassword());

What makes this frustrating for me is that get_isDBUserName(),
get_isDBPassword() are fetching information from the configuration
file and to make matters worse the configuration file has a line to
specify the database but the code doesn't use it.

Dudley Irish
dirish@arsmagna.com

Mime
View raw message