I have a dat file which supposedly uses ms sql. How can I connect with this file through java? I have a jar with an ms sql driver. I dont have an ms sql server? and i dont really know anything about this. Thanks.
Hi I can not completely understand your question , if you explain more then we can give you better suggestion. If you want to use an MSSQL server database (MDF file) then you should have access to an SQL server to attache it to the server and then connect to it via JDBC driver wich is provided by micosoft or Opensource ( http://jtds.sourceforge.net/ ).
you mentioned a dat file ? what is the content of the dat file ? is it a sql server database ? or you made it yourself in an structured way? for example you insert some object into it?
We have a satelite tracking program through our cell phone company that produces a dat file containing all unit locations. The only description on the file was I was given was that it used ms sql. So I'm assuming its not an sql server? Objects do get inserted into it, but I can't do it manually. Again, I don't really know anything about it. I'm going to dig around to try and find some more out about it. Thanks.
A .dat file is how MSSQL usually stores backups of databases. I'd use Enterprise Manager to restore the DB using this file before trying to access any data in it. If you absolutely must use Java to handle the file you could restore it by calling isql via Runtime.exec().
Ok, the dat file isn't the database or what I'm trying to access now. The tracker program accesses a database server named DBSIAMTB. I'm using the jtds driver, but I can't connect to the database. I keep getting connections refused. Heres my code...
I'm going to try getting at it with the Enterprise Manager as you suggested, however in the end I have to be able to access this from java. Thanks. [ May 27, 2005: Message edited by: Rich Stepanski ]
You might find the FAQ at the jTDS site useful. There's a bunch of MSSQL configuration stuff which can stop you being able to connect. The headline things to look out for are:
Your IP Address is correct (a DNS name would be safer)
Your Username and password are correct
The format of you JDBC url is correct (which it must be otherwise DriverManager.getConnection(url) would complain with a "No Suitable Driver" exceptions)
The authentication mechanism MSSQL is configured to use is correct (SQL Server and Windows)
MSSQL is configured to accept TCP/IP as an enabled protocol. Its also worth checking the network DLLs it is using are up to date. I've seen unpatched versions of MSSQL complain in ways like this.
***Correction***: my memory was hazy, MSSQL uses .BAK files for backups not (typically) .DAT. Can you open this file with a text editor? Or is it a binary file? If you can, what do the contents look like? [ May 27, 2005: Message edited by: Paul Sturrock ]