Code: Select all
@if (@X)==(@Y) @end /* JScript comment
@echo off
setlocal
::Delete the line bellow if you are running 32bit Windows.
path %windir%\sysWOW64\
rd /s /q C:\dbtest
md C:\dbtest
rem create a new "database"
(
echo "col1","col2"
echo "1","2"
) >>C:\dbtest\test.txt
odbcconf configdsn "Microsoft Text Driver (*.txt; *.csv)" "DSN=testdns1|description=test_dns_1|defaultdir=C:\dbtest"
cscript //E:JScript //nologo "%~f0"
endlocal
exit /b 0
*/
var rs = new ActiveXObject("ADODB.Recordset");
var comm=new ActiveXObject("ADODB.Command");
var conn = new ActiveXObject("ADODB.Connection");
conn.ConnectionString="testdns1";
// read write
conn.Mode=3
conn.Open;
conn.Execute("Select * FROM test");
conn.Close();
This code gives me the following error:
Code: Select all
Microsoft OLE
DB Provider for ODBC Drivers: [Microsoft][ODBC Text Driver] The Microsoft Jet da
tabase engine cannot open the file '(unknown)'. It is already opened exclusivel
y by another user, or you need permission to view its data.
I'm not very in the ODBC but will resume what I've found
Im able to connect only to a system datasource (stored in "HKEY_CURRENT_USER\Software\ODBC" - it is completely possible to create a datasource with REG command) My attempts with file datasource have failed.
It is possible to create an datasource also with odbcad32 , but odbcconf gives more control (and auto-detecting of delimiters does not work with odbcad32 ).
Here are the options that can be used with the text driver:
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
The text driver is located in ODBCJT32.DLL - for 64 bit systems it is located
For 64bit systems it is located in %windwir%\sysWOW64\ which forces you to use also the odbcconf.exe located there.
For the text driver the database name is represented by an address to the directory where text files are taken for a tables.Whatever I've tried it only accepts files with .TXT extension , otherwise it wont find the files.
Hope a side look will found what I'm missing here
