This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hi, I wish to connect to a database existing on another machine on the LAN, given the server name, IP address, login and password for the db.How can I do it? Thanks. Cheers Jyothsna.
DriverManager.getConnection() takes a URL, user name and password as arguments. Check your JDBC driver documentation to see exactly how the URL is constructed. For example the JDBC-ODBC bridge starts with
[ September 25, 2003: Message edited by: Joe Ess ]
Darn smilies. that should be jdbc, a colon, then odbc.
Jyothsna Sri Y
Ranch Hand
Joined: Sep 25, 2003
Posts: 35
posted
0
Hey Joe, Thanks a ton for the immediate response. But it's urgent!!! I wanted to know how to connect to a database which exists on another system named for example "WorkStation40" where the table name is "PQR" and the user name is "abc" and password "123". How am I supposed to frame the URL? Where does it go in the general code of type: String url = new String("jdbc dbc sn"); Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con = DriverManager.getConnection(url,"abc","123"); Thanks. cheers Jyothsna.
Jyothsna Sri Y
Ranch Hand
Joined: Sep 25, 2003
Posts: 35
posted
0
That was supposed to be jdbc followed by a colon followed by odbc, colon dsn. Jyothsna
Rema Remulta
Ranch Hand
Joined: Apr 03, 2002
Posts: 51
posted
0
hi, In case you haven't found the solution of the problem, this is how to do it: Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); con = DriverManager.getConnection("jdbc:microsoft:sqlserver://10.0.0.1:1669;DatabaseName=" + database + ";User=" + userID + ";Password=" + pwd + "");
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.