Ivor Lithan

+ Follow
since May 30, 2004
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ivor Lithan

What mode of security are you running on your sql box? - 2000 sets the mode to windows authentication as standard - you may want to try setting it to mixed mode - and seeing if that works
When we used tomcat, in our application context we could put an entry like

in the server.xml file

and then get it via a JNDI lookup.
How would I do this in JBoss?

19 years ago
probably of no use to you now, but incase you were interested :

INSERT INTO dest (ID, V1, V2)
(SELECT ID, V1,V2 from SRC);

was what you wanted - the VALUE keyword isn't needed.
ok - level of desperation time - add the jars explicitly to your class path, i.e :

C:\SQLServerDriver\lib\sqlserver.jar;C:\SQLServerDriver\lib\msutil.jar and so on

Well, the one time I used that was when I had a servlet that implemented runnable, with the idea being I could have a thread running and then query it through the web front end - and this servlet was kicked off by a scheduler that I had written - and so it used that bit of code to start it all off - other than that I've never used it for anything
20 years ago

I have also set my CLASSPATH to the following
C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib

Oops I completly missed that bit. My bad.

the only thing I can think of, off the top of my head right now, is the spaces in the file path. try moving the jars somewhere where you have no spaces in the path i.e. c:\lib or something?
You need to move the jar files (msbase.jar, mssqlserver.jar, msutil.jar) from the lib directory of the default install location of the drivers, i.e. C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib - into your class path, somewhere along the way.
Your class compiles fine because you don't actually reference the sql driver until run time.
Not quite sure what you mean, but if you mean what I think you do, you could do :

or am I missing what you are asking?
20 years ago

sqltext="insert into AllIn (Name, Adnno, Class, Section, Date, Adnfee) values ('"+s1+"','"+s2+"','"+s3+"','"+s4+"','"+s5+"','"+s6+"' )";

You say you get a syntax error when you do this - is that at compile time, or when you run it? - i.e. is it a sql sytnax error?

What url are you using to test it?

Maybe I'm missing something here but, I think you have a fundamental problem here...

you do this

At no point do you assign anything to the result set - looking at your code you don't use anything from the select statements/resultset - so I would strip all of that out, which will leave you just with your insert statement.

Also, since you are using a preparedstatement it would be better to do your sql call like this :

This way you don't need to worry about wrapping strings in quotes and so on?