Hi All,

I want to develope database-driven application using JSP and JRun as the server.
THe thing I want to know is how do I connect to the MSSQL Server 2000 database using JSP?
What type of JDBC?
And how to install the JDBC driver?

Thanks in advance... :)

Recommended Answers

All 7 Replies

don't connect to the database from JSP. Do it from servlets.
And to install the driver, follow the installation instructions.

I think you need to connect with JDBC driver for your application, you need to first creat a database in MS SQL Server and go to the Control Panel and click on Administrative tools, click on ODBC Data source and you will get a dialog box ODBC data source Administrator and select the tab User DSN in tab just select the dbase files and click on ADD button where you get dialog box to create a new data source in sql server and click next and it check for the availabilty of the dsn created in sql server if it is found the connection will be established and you can work with JDBC for your Application

I hope , i answered your query, if this is not your answer ,please reply me with your correct answer if you have found.

Thanks a Lot!!:)

On thing I would say is "Just Say NO!" to MS SQL 2000... It is NOT a good DB... it is prone to deadlocks and on any serious system it will be a serious weakness... the number of concurrent supportable users will be microscopic compared to a real DB...

I think tinamary may have made a mistake or 2... the instructions she gave are for creating an ODBC data source on a windows server... to use that you would need an ODB-JDBC bridge... which you can find, though some of them have very poor performance and the best ones are commercial... because of the nature of making a good one... you may be able to find a good ODBC-JDBC bridge at the apache software foundation... I don't actually recall....

There ARE actually JDBC drivers made for the SQL server...

Typically they are in a JAR file which goes in the WEB-INF/libs or in the application servers shared or common location.... then you need to load the driver in the application using driver loader... then you just go through the steps of creating the connect using the server address, type, username and password, etc. based on the requirements of the driver and the DB...

I migrated a system from PostgreSQL to MS SQL several years ago, simply because the customer companies new IT manager didn't know anything but MS Windows and MS SQL... They spent thousands on the migration and the performance dropped significantly.... it was not a code issue, just a DB server performance issue...

Since PostgreSQL and MY SQL are both free, why would you bother with something which has crazy licensing structures and worse performance...? Unless the customer demanded it...

BUT all too often developers and consultants eager to get the bid don't do their jobs right and fail to advise the customer on the true benefits and failing of the desired or proposed system...

Sometimes, when they know the facts, they change their mind, sometimes they don't, BUT then it is their choice and their responsibility... when they later complain about how slow your system is, or how few concurrent users can be supported... or the famous one... the server "seems" to be running but the whole system has become non-responsive with no error messages.... then you tell them it is a MS SQL server unresolvable deadlock, your database is corrupted, you'll have to restore from your most recent backup, unless you have spent money on a transaction log tracker we can't walk through the logs and rebuild the data to last valid transaction... and oh, this is your fault because you chose to use this DB, so we are charging you for all this time to restore the system, but it WILL happen again... when you are MOST busy...

This is NOT the ranting of an MS hater... this is based on the TRUE occurrence of actual events...

The software was an Enterprise System designed to run on Oracle, and many other "real" RDBMS systems, and MS SQL.... However, the weaknesses of MS SQL are ALWAYS detailed to the customers since MS SQL is NOT truly and Enterprise quality RDBMS... Many customers select MS SQL because it is what they already have... no one from MS every told them it doesn't actually function well in an Enterprise System nor that it doesn't stack up again most Open Source DBs lets alone Oracle...

So we make it clear that the choice is theirs, it is against our recommendation and we detail the reasons... then when they have issues... they don't all have AS serious of issues as those I mentioned above, but not all "Enterprise Systems" ever get full Enterprise use either... However, those that DO get a high level of usage, WILL have the problems I mentioned... and then there WILL be data corruption half finished transactions with NO way to roll them back at that point and no way to restore to the last valid transaction without an expense commercial tool...
And as I said... you will NOT want to do all that restoration or even investigation work for free.... so you will have to tell the customer this is what they were warned about, this is why your warned them and it was their choice so it is their responsibility and then you will have to lay the price tag down on them...

THEN you should lay another project proposal down showing the costs to migrate the system to PostgreSQL or My SQL, and the future operating costs of staying with MS SQL should this issue continue to happen, likely more and more frequently as usage builds....
The see if they will pay you to fix it so it runs on a real DB....

I don't count MS SQL as a "real" DB... I count it more as a toy...

I frequently use MS SQL 7, ,MS SQL 2000, MS SQL 2003 and MS SQL 2005... I use Oracle sometimes, and I use PostgreSQL and My SQL as much as I can... So I am not just repeating what I heard others say, Every word of this is directly based on my own experience with these DBs...

Peace & Good Luck...

ah, another "expert" answer from rg...
Kid, MS SQL Server is a serious database used in massive transactional systems responsible for tens of millions (or more) of dollars of revenue each day per system.
Hardly "a toy".

Quite in contrast to MySQL and PostreSQL which ARE toys.

Hi,
I had the same problem.the main problem is when u r using MS SQL Server,u will b connected to a server.Basically,in Oracle,username would b scott and password would b tiger.Here, the user name and password would b "sa".If u r working on a standalone machine(u r personal PC),then u can give the username and password as "sa".If u r working in a network,then u need to connect to the server first.After u get connected,type username and password as "sa".
In u r program as well,give the username and password as "sa". What I would suggest u is write a simple java program with .java extension.import java.beans in it.That would make it a bean.Write u r sql code there.
In the JSP,use this tag on the top
<jsp:useBean id="somei.d." scope="session" class="package.BeanClassName" />
Whenever u want to access the function of the bean,use beanid.function() to call u r function.

I hope it's too confusing.

*** One more important thing....When u create an ODBC driver,create it in the SystemDSN tab.Don't create it in the userDSN tab.U may ignore the above said lines,but don't ignore this....
I hope it works....All the best....

"Basically,in Oracle,username would b scott and password would b tiger."

Only if the database engine were installed with all the defaults and not properly secured.
Any DBA worth his money will delete that account as soon as he's created a real one.

Same with the default account on any other database engine on any serious system.

commented: Yes, we already have a lot of crackers running around here and there ;-) +19

Hi,
Ya,,,anyone would prefer making their database as secure.But since the question was for the begginers,I have given the default username and password.Later on,u may change it accordingly. In a stand alone PC,the user name and password remain the same,if u have installed the DB with default options.
Anyways,plz let me know if my message was helpful.Even I am a begginer.

Create the ODBC driver in system DNS tab.Don't create it in the User DNS tab.May b that will help.

Regards.....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.