Try this code. For this you need to create one ODBC datasource using the utility ' Data Source (ODBC' under control panel in Windows OS. (if you are using Unix OS check the docs, how to create ODBC datasource)
In your java code add these line
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection dbConnection = DriverManager.getConnection("jdbc:odbc:YourDataSourceName", "DataBaseUserID", "Password");
Statement dbStatement = dbConnection.createStatement ();
locally this will work i have done it many times. i also did on local area network. but r u sure JdbcOdbcDriver works on Internet that is can i connect to database at web server from client. I have never tried this and i dont have a server database at my web server so i cant check whether it works on Internet or not. please tell me if u have done it
please reply
regards parul
Q>>>>>but r u sure JdbcOdbcDriver works on Internet that is can i connect to database at web server from client
A) JdbcOdbcDriver will work in any Webservers supporting Java.
Q>>>>>I have never tried this and i dont have a server database at my web server
I don't understand what you mean by server databse in web server ?
Tomy
And what kind of client are you running?
An application client could be done by setting up a ODBC DSN on each client machine. Java doesn't do this, you have to find some other method to do it.
A browser client has security issues, although as long as the database is on the web server the problems are less.
A browser client will not normally use ODBC, since it requires a seperate installation (note DSN-less connections STILL require an install, to get the ODBC MS SQL driver.) Since the normal MS SQL driver is ODBC you need to find another solution:
-Use the freetds driver, from www.freetds.org
-Use a proxy driver, either a commercial one (search the sun site for drivers) or the one from http://www.objectweb.org/ called RmiJdbc
dear jschell
i can make an installer in vb which will create a dsn while installing my java application
please tell me whether i need a system dsn or a user dsn
some people say i will need to create a system dsn when i am connecting a database over internet
regards
parul