You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Kevin O' Leary <ha...@hotmail.com> on 2003/04/08 16:09:02 UTC

Tomcat Data Source Reference in code

Hi all,

I have been searching all over and I can't find an answer to this.
I'm a convert from ColdFusion to Java and I am able to make a
connection to SQL Server using Tomcat and the following code:

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con=DriverManager.getConnection
("jdbc:odbc:test2","myusername","mypass");

The problem is that this is a shared environment and I don't want to
put the SQL username/pass in the source code. I know that cold fusion
and tomcat each have the ability to assign datasources (the one above
I used window's odbc connection manager). Since you have to put the
connection information u/p in the administrator for the db, how do I
reference that in jsp?

On a separate issue (probably related), when I create a data source
in the tomcat admin, it does not show up in the windows odbc
connections, which is probably why I can't reference it.

Any suggestions oh gurus of Tomcat?

Thanks in advance!


_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE*  
http://join.msn.com/?page=features/junkmail


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org