Please members , i need to help me ..
now i'm establishing my graduate project, and i'm useing java programming language,and sql server to implement the application, but i face problem, that i don't know how i can connect java with sql server.
so i hope from you to help me please, and if possible explain that step by step, and support that by simple pictures, becuase these steps is very necessary for me.
note : i download JDBC driver from microsoft web site for connection, and attempt by simple tests to make connection but i failed.
THANKS FOREVER
Last edited by mkcit; 03-24-2007 at 03:00 PM.
This is the code for connecting to a mysql server that I made for another post
Code:package net.codecall.forums.general; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; public class MySqlConnect { public static void main(String args[]) { Connection con = null; String dbname = ""; String dbuname = ""; String dbpassword = ""; try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql:///" + dbname, dbuname, dbpassword); if(!con.isClosed()){ System.out.println("Successfully connected to " + dbname); } } catch(Exception e) { System.err.println("Exception: " + e.getMessage()); } finally { try { if(con != null){ con.close(); } } catch(SQLException e) {} } } }
Thanks Mr Sidewinder for code, but in fact i want the way to connect by sql server.
Check this article HOW TO: SQL in JAVA for details on how to connect to SQL Server database from C#.NET database applications as well as Java database applications. It also describes how to pass embedded SQL queries (SELECT, INSERT, UPDATE, DELETE), calling stored procedures, pass parameters etc.
Shahriar Nour Khondokar
Maybe if it still doesn't work use a different server
This is a three year old thread!
There are currently 2 users browsing this thread. (0 members and 2 guests)
Bookmarks