[Snowflake-ODBC]Can't get column info succesfully with SQLColumns API - odbc
I hit a issue with snowflake-odbc driver to collect all the columns' metadata of table;
A> Download the odbc driver from
https://sfc-repo.snowflakecomputing.com/odbc/linux/2.21.6/snowflake_linux_x8664_odbc-2.21.6.tgz
B> Install and config the odbc driver with doc in snowflake site:
https://docs.snowflake.com/en/user-guide/odbc-linux.html
I install it with unixodbc_setup.sh automatically and only updates the SF_ACCOUNT info, configure database and Warehouse values in /etc/odbc.ini
c> Test the driver with isql which works fine
[root#sflake1 lib]# isql -v snowflake user password
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL> select * from test_vch
+-----------+-----+--------------------------------------------------+
| V10 | V100 | V255 |
+-----------+------------------+----------------+
| v10 | v100 | v255 |
| a | b | c |
| aa | bb | cc |
+-----------+---------------+
SQLRowCount returns 3
3 rows fetched
SQL> quit;
d> I try to get the columns with SQLCOLUMNS API;
Implement the tested C codes likes below:
RETCODE getColumns(SQLHSTMT hstmt, SQLCHAR* tablename)
{
SQLRETURN rc;
SQLCHAR szSchema[STR_LEN];
SQLCHAR szCatalog[STR_LEN];
SQLCHAR szColumnName[STR_LEN];
SQLCHAR szTableName[STR_LEN];
SQLCHAR szTypeName[STR_LEN];
SQLCHAR szRemarks[REM_LEN];
SQLCHAR szColumnDefault[STR_LEN];
SQLCHAR szIsNullable[STR_LEN];
SQLINTEGER ColumnSize;
SQLINTEGER BufferLength;
SQLINTEGER CharOctetLength;
SQLINTEGER OrdinalPosition;
SQLSMALLINT DataType;
SQLSMALLINT DecimalDigits;
SQLSMALLINT NumPrecRadix;
SQLSMALLINT Nullable;
SQLSMALLINT SQLDataType;
SQLSMALLINT DatetimeSubtypeCode;
SQLLEN cbCatalog;
SQLLEN cbSchema;
SQLLEN cbTableName;
SQLLEN cbColumnName;
SQLLEN cbDataType;
SQLLEN cbTypeName;
SQLLEN cbColumnSize;
SQLLEN cbBufferLength;
SQLLEN cbDecimalDigits;
SQLLEN cbNumPrecRadix;
SQLLEN cbNullable;
SQLLEN cbRemarks;
SQLLEN cbColumnDefault;
SQLLEN cbSQLDataType;
SQLLEN cbDatetimeSubtypeCode;
SQLLEN cbCharOctetLength;
SQLLEN cbOrdinalPosition;
SQLLEN cbIsNullable;
SQLLEN numRecs = 0;
SQLCHAR SqlState[6], SQLStmt[100], Msg[SQL_MAX_MESSAGE_LENGTH];
SQLINTEGER NativeError;
SQLSMALLINT i, MsgLen;
rc = SQLColumns(hstmt, NULL, 0, (SQLCHAR*)"PUBLIC", SQL_NTS, tablename, SQL_NTS, NULL, 0);
if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO) {
SQLBindCol(hstmt, 1, SQL_C_CHAR, szCatalog, STR_LEN,&cbCatalog);
SQLBindCol(hstmt, 2, SQL_C_CHAR, szSchema, STR_LEN, &cbSchema);
SQLBindCol(hstmt, 3, SQL_C_CHAR, szTableName, STR_LEN,&cbTableName);
SQLBindCol(hstmt, 4, SQL_C_CHAR, szColumnName, STR_LEN, &cbColumnName);
SQLBindCol(hstmt, 5, SQL_C_SSHORT, &DataType, 0, &cbDataType);
SQLBindCol(hstmt, 6, SQL_C_CHAR, szTypeName, STR_LEN, &cbTypeName);
SQLBindCol(hstmt, 7, SQL_C_SLONG, &ColumnSize, 0, &cbColumnSize);
SQLBindCol(hstmt, 8, SQL_C_SLONG, &BufferLength, 0, &cbBufferLength);
SQLBindCol(hstmt, 9, SQL_C_SSHORT, &DecimalDigits, 0, &cbDecimalDigits);
SQLBindCol(hstmt, 10, SQL_C_SSHORT, &NumPrecRadix, 0, &cbNumPrecRadix);
SQLBindCol(hstmt, 11, SQL_C_SSHORT, &Nullable, 0, &cbNullable);
SQLBindCol(hstmt, 12, SQL_C_CHAR, szRemarks, REM_LEN, &cbRemarks);
SQLBindCol(hstmt, 13, SQL_C_CHAR, szColumnDefault, STR_LEN, &cbColumnDefault);
SQLBindCol(hstmt, 14, SQL_C_SSHORT, &SQLDataType, 0, &cbSQLDataType);
SQLBindCol(hstmt, 15, SQL_C_SSHORT, &DatetimeSubtypeCode, 0, &cbDatetimeSubtypeCode);
SQLBindCol(hstmt, 16, SQL_C_SLONG, &CharOctetLength, 0, &cbCharOctetLength);
SQLBindCol(hstmt, 17, SQL_C_SLONG, &OrdinalPosition, 0, &cbOrdinalPosition);
SQLBindCol(hstmt, 18, SQL_C_CHAR, szIsNullable, STR_LEN, &cbIsNullable);
}
while (SQL_SUCCESS == rc) {
rc = SQLFetch(hstmt);
if (rc == SQL_NO_DATA_FOUND){
printf("SQL_NO_DATA_FOUND:All result done...");
break;
}
else if(rc != SQL_SUCCESS){
SQLGetDiagField(SQL_HANDLE_STMT, hstmt, 0, SQL_DIAG_NUMBER, &numRecs, 0, 0);
// Get the status records.
i = 1;
while (i <= numRecs && (rc = SQLGetDiagRec(SQL_HANDLE_STMT, hstmt, i, SqlState, &NativeError,Msg, sizeof(Msg), &MsgLen)) != SQL_NO_DATA) {
printf("SqlState:%s\n", SqlState); <------ Will show errors here
printf("NativeError:%d\n", NativeError);
printf("Msg:%s\n", Msg);
i++;
}
break;
}
printf("szColumnName=%s,szTypeName=%s,DataType=%d,ColumnSize=precision=%d",szColumnName,szTypeName,DataType,ColumnSize);
}
SQLFreeStmt(hstmt, SQL_UNBIND);
SQLFreeStmt(hstmt, SQL_CLOSE);
return rc;
}
The error message shows:
SqlState:S1000
NativeError:6
Msg:[Snowflake][Snowflake] (6)
Assertion failure: USER_DEFINED_TYPE_type_unsupported
The odbc.ini, odbcinst.ini and simba.snowflake.ini are attached below:
[root#sflake1 log]# more /etc/odbc.ini
[snowflake]
Description=SnowflakeDB
Driver=SnowflakeDSIIDriver
Locale=en-US
SERVER=cy72957.us-east-2.aws.snowflakecomputing.com
PORT=443
SSL=on
ACCOUNT=cy72957.us-east-2.aws
database=testdbu
Warehouse=COMPUTE_WH
[root#sflake1 log]# more /etc/odbcinst.ini
# Example driver definitions
# Driver from the postgresql-odbc package
# Setup from the unixODBC package
[PostgreSQL]
Description = ODBC for PostgreSQL
Driver = /usr/lib/psqlodbcw.so
Setup = /usr/lib/libodbcpsqlS.so
Driver64 = /usr/lib64/psqlodbcw.so
Setup64 = /usr/lib64/libodbcpsqlS.so
FileUsage = 1
# Driver from the mysql-connector-odbc package
# Setup from the unixODBC package
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/libmyodbc5.so
Setup = /usr/lib/libodbcmyS.so
Driver64 = /usr/lib64/libmyodbc5.so
Setup64 = /usr/lib64/libodbcmyS.so
FileUsage = 1
[SnowflakeDSIIDriver]
APILevel=1
ConnectFunctions=YYY
Description=Snowflake DSII
Driver=/root/snowflake/snowflake_odbc/lib/libSnowflake.so
DriverODBCVer=03.52
SQLLevel=1
[root#sflake1 lib]# more simba.snowflake.ini
# To use this INI file, replace [INSTALLDIR] with the
# directory the tarball was extracted to.
[Driver]
ANSIENCODING=UTF-8
## Note that this default DriverManagerEncoding of UTF-32 is for iODBC. unixODBC uses UTF-16 by default.
## If unixODBC was compiled with -DSQL_WCHART_CONVERT, then UTF-32 is the correct value.
## Execute 'odbc_config --cflags' to determine if you need UTF-32 or UTF-16 on unixODBC
DriverManagerEncoding=UTF-16
DriverLocale=en-US
ErrorMessagesPath=/root/snowflake/snowflake_odbc/ErrorMessages/
LogLevel=0
LogNamespace=
LogPath=/root/snowflake/snowflake_odbc/log
CURLVerboseMode=false
CABundleFile=/path/to/cacert.pem
## - Uncomment the ODBCInstLib corresponding to the Driver Manager being used.
## - Note that the path to your ODBC Driver Manager must be specified in LD_LIBRARY_PATH (LIBPATH for AIX, DYLD_LIBRARY_PATH for Darwin).
## - Note that AIX has a different format for specifying its shared libraries.
# Generic ODBCInstLib
# iODBC
#ODBCInstLib=libiodbcinst.so.2
# SimbaDM / unixODBC
#ODBCInstLib=libodbcinst.so
# Darwin specific ODBCInstLib
# iODBC
#ODBCInstLib=libiodbcinst.dylib
# AIX specific ODBCInstLib
# iODBC
#ODBCInstLib=libiodbcinst.a(libiodbcinst.so.2)
# SimbaDM
#ODBCInstLib=libodbcinst.a(odbcinst.so)
# unixODBC
ODBCInstLib=/usr/lib64/libodbcinst.so
CABundleFile=/root/snowflake/snowflake_odbc/lib/cacert.pem
Related
Drupal error - Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET
Installed Drupal 10/ MariaDB with Docker. Managed through the installation wizard, but when I go to the homepage after installation completes I see: (had to enable debugging) The website encountered an unexpected error. Please try again later. Symfony\Component\HttpKernel\Exception\NotFoundHttpException: No route found for "GET http://localhost:8083/" in Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest() (line 128 of /opt/drupal/vendor/symfony/http-kernel/EventListener/RouterListener.php). Drupal\Core\Routing\AccessAwareRouter->matchRequest(Object) (Line: 106) Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest(Object, 'kernel.request', Object) call_user_func(Array, Object, 'kernel.request', Object) (Line: 111) Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.request') (Line: 139) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 74) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 681) Drupal\Core\DrupalKernel->handle(Object) (Line: 19) Here's my docker-compose file: version: '3' services: drupal: image: drupal:10.0.2 ports: - 8083:80 volumes: - ./drupal_modules:/var/www/html/modules - ./drupal_profiles:/var/www/html/profiles - ./drupal_themes:/var/www/html/themes - ./drupal_sites:/var/www/html/sites # restart: always mariadb: image: mariadb:10.10 volumes: - mariadb:/var/lib/mysql environment: TZ: "Europe/Rome" MYSQL_ALLOW_EMPTY_PASSWORD: "no" MYSQL_ROOT_PASSWORD: "rootpwd" MYSQL_USER: 'drupal' MYSQL_PASSWORD: 'drupal' MYSQL_DATABASE: 'drupal' volumes: mariadb: # drupal_modules: # drupal_profiles: # drupal_themes: # drupal_sites: I can successfully view database and table in the mariadb container: > docker exec -it 348cd7dc8853 sh # mysql -udrupal -p Enter password: Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 4 Server version: 10.10.2-MariaDB-1:10.10.2+maria~ubu2204 mariadb.org binary distribution Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [(none)]> show databases -> ; +--------------------+ | Database | +--------------------+ | drupal | | information_schema | +--------------------+ 2 rows in set (0.000 sec) MariaDB [(none)]> use drupal Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Database changed MariaDB [drupal]> show tables; +------------------+ | Tables_in_drupal | +------------------+ | batch | | cache_config | | cache_container | | cache_data | | cachetags | | config | | key_value | | queue | | sequences | | sessions | | user__roles | | users | | users_data | | users_field_data | +------------------+ 14 rows in set (0.001 sec)
ERROR MY-011542 Repl Plugin group_replication reported: 'Table repl_test does not have any PRIMARY KEY
I installed an InnoDB Cluster recently and trying to create a table without any primary key or equivalent to test the cluster index concept where "InnoDB internally generates a hidden clustered index named GEN_CLUST_INDEX on a synthetic column containing row ID values if the table has no PRIMARY KEY or suitable UNIQUE index". I created table as below: create table repl_test (Name varchar(10)); Checked for the creation of GEN_CLUST_INDEX: select * from mysql.innodb_index_stats where database_name='test' and table_name = 'repl_test'; +---------------+------------+-----------------+---------------------+--------------+------------+-------------+-----------------------------------+ | database_name | table_name | index_name | last_update | stat_name | stat_value | sample_size | stat_description | +---------------+------------+-----------------+---------------------+--------------+------------+-------------+-----------------------------------+ | test | repl_test | GEN_CLUST_INDEX | 2019-02-22 06:29:26 | n_diff_pfx01 | 0 | 1 | DB_ROW_ID | | test | repl_test | GEN_CLUST_INDEX | 2019-02-22 06:29:26 | n_leaf_pages | 1 | NULL | Number of leaf pages in the index | | test | repl_test | GEN_CLUST_INDEX | 2019-02-22 06:29:26 | size | 1 | NULL | Number of pages in the index | +---------------+------------+-----------------+---------------------+--------------+------------+-------------+-----------------------------------+ 3 rows in set (0.00 sec) But, when I try to insert row, I get the below error: insert into repl_test values ('John'); ERROR 3098 (HY000): The table does not comply with the requirements by an external plugin. 2019-02-22T14:32:53.177700Z 594022 [ERROR] [MY-011542] [Repl] Plugin group_replication reported: 'Table repl_test does not have any PRIMARY KEY. This is not compatible with Group Replication.' Below is my conf file: [client] port = 3306 socket = /tmp/mysql.sock [mysqld_safe] socket = /tmp/mysql.sock [mysqld] socket = /tmp/mysql.sock port = 3306 basedir = /mysql/product/8.0/TEST datadir = /mysql/data/TEST/innodb_data log-error = /mysql/admin/TEST/innodb_logs/mysql.log log_bin = /mysql/binlog/TEST/innodb_logs/mysql-bin server-id=1 max_connections = 500 open_files_limit = 65535 expire_logs_days = 15 innodb_flush_log_at_trx_commit=1 sync_binlog=1 sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES binlog_checksum = NONE enforce_gtid_consistency = ON gtid_mode = ON relay-log=<<hostname>>-relay-bin My MySQL version: mysql Ver 8.0.11 for linux-glibc2.12 on x86_64 (MySQL Community Server - GPL)
Auto-generation of the PK should work fine for non-clustered setups. However, InnoDB Cluster (Group Replication) and Galera need a user PK (or UNIQUE that can be promoted). If you like, file a documentation bug with bugs.mysql.com complaining that this restriction is not clear. Be sure to point to the page that needs fixing.
ESP8266 (NodeMCU) Creating a sqlite3 database (with lua) is not possible
I want to use a sqlite3 database at my ESP8266 NodeMCU microproessor. The firmware is: NodeMCU custom build by frightanic.com branch: master commit: 67027c0d05f7e8d1b97104e05a3715f6ebc8d07f SSL: false modules: bit,bme280,cron,dht,file,gpio,i2c,net,node,rfswitch,rtctime,sntp,sqlite3,tmr,uart,wifi build created on 2018-04-16 16:06 powered by Lua 5.1.4 on SDK 2.2.1(cfd48f3) The (main part) of the code I use is: (The complete code follows later at this post) -- Wenn Tabelle nicht exisiert, ohne Daten anlegen sql = "CREATE TABLE IF NOT EXISTS '"..tabelle.."' ('"..lokal.."' number,'"..sntp.."' number)" status = db:exec(sql) print(sql) print("Status Anlage '"..tabelle.."': ",status) The log is: > -- drop_sntptab() > existenzsicherung_sntptab() E:M 4272 CREATE TABLE IF NOT EXISTS 'abgleich' ('lsync' number,'ssync' number) Status Anlage 'abgleich': 7 SELECT count(*) FROM 'abgleich' no such table: abgleich You see, the table is not created althougt the SQL-Statement seems to be right. The opening command is: db = sqlite3.open(database) Find following the complete Script: database = 'sntp.db' tabelle = 'abgleich' lokal = 'lsync' sntp= 'ssync' l0 = 1514764800 -- Epoche-Time 01.01.2018 00:00:00 s0 = 1514764800 -- Epoche-Time 01.01.2018 00:00:00 function open_db() -- Datenbankdatei allokieren db = sqlite3.open(database) end function close_db() status = db:close() print("Status DB-schliessen: ", status) end function delete_sntp_database() -- Datenbankdatei wird geloescht file.remove(database) end function drop_sntptab() --- Tabelle loeschen sql = "DROP TABLE '"..tabelle.."';" status = db:exec(sql) print(sql) print("Status DROP "..tabelle..": ",status) end function existenzsicherung_sntptab() -- Wenn Tabelle nicht exisiert, ohne Daten anlegen sql = "CREATE TABLE IF NOT EXISTS '"..tabelle.."' ('"..lokal.."' number,'"..sntp.."' number)" status = db:exec(sql) print(sql) print("Status Anlage '"..tabelle.."': ",status) -- Anzahl der Datenaetze ermitteln sql = "SELECT count(*) FROM '"..tabelle.."'" print(sql) for tmp in db:urows(sql) -- Anzahl Datensätze do anzahl = tmp end print('Anzahl Datensaetze: ',anzahl) -- Wenn Anzahl der Datensätze 0 ist, wird eine Datenzeile eingefügt if anzahl == 0 then sql = "INSERT INTO '"..tabelle.."' ('"..lokal.."', '"..sntp.."') values ("..l0..","..s0..")" status = db:exec(sql) print(sql) print("Status Eingabe Feldwerte: ",status) end -- Ausgabe des Tabelleninhalts -- urows ermöglicht die Zeilenweise Ausgabe des Select - Ergebnis sql = "SELECT * FROM '"..tabelle.."'" for lokal,sntp in db:urows(sql) do print(lokal,sntp) end end function ermittel_lastlokal() sql = "SELECT * FROM '"..tabelle.."' WHERE _ROWID_ = 1;" for v1,v2 in db:urows(sql) do print("Ergebniszeile(n): ",v1,v2) lastlokal = v1 lastsntp = v2 end end -- delete_sntp_database() open_db() -- drop_sntptab() existenzsicherung_sntptab() -- ermittel_lastlokal() close_db() Can anyone see my mistake? Thank you very much in advance Regards Kleinlaut
Install Postfix dovecot with mysql background
I have spent about 3 days to install the Postfix, dovecot and mysql on my VPS server. It has been a very frustrating process. I have googled painfully for 3 days and collected the information piece by piece and eventually made this combination work. Just want to list steps and all configuration files together, hopefully useful for who is also undergoing the painful process. make mysql ready, and create database postfix (or whatever the name you want), create mysql user postfix and grant all privilege to postfix database. Create the following tables: CREATE TABLE virtual_domains ( id int(11) NOT NULL auto_increment, name varchar(50) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE virtual_aliases ( id int(11) NOT NULL auto_increment, domain_id int(11) NOT NULL, source varchar(100) NOT NULL, destination varchar(100) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; CREATE TABLE virtual_users ( id int(11) NOT NULL auto_increment, domain_id int(11) NOT NULL, password varchar(32) NOT NULL, email varchar(100) NOT NULL, maildir varchar(255) NOT NULL, PRIMARY KEY (id), UNIQUE KEY email (email), FOREIGN KEY (domain_id) REFERENCES virtual_domains(id) ON DELETE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; Compile Postfix with mysql support, you should see the bunch of postfix configuration files: main.cf [root#mail postfix]#postconf -n alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases command_directory = /var/postfix/usr/sbin compatibility_level = 2 daemon_directory = /var/postfix/usr/libexec/postfix data_directory = /var/lib/postfix debug_peer_level = 2 debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6 /binddd $daemon_directory/$process_name $process_id & sleep 5 home_mailbox = Maildir/ html_directory = no inet_interfaces = all inet_protocols = ipv4 mail_owner = postfix mail_spool_directory = /home mailq_path = /var/postfix/usr/bin/mailq manpage_directory = /usr/local/man meta_directory = /etc/postfix mydomain = myspeedshow.com myhostname = mail.yourdoamin.com mynetworks_style = host myorigin = $mydomain newaliases_path = /var/postfix/usr/bin/newaliases postscreen_greet_banner = "before smtp banner" postscreen_greet_wait = 2s postscreen_non_smtp_command_enable = no postscreen_pipelining_enable = no queue_directory = /var/spool/postfix readme_directory = no recipient_delimiter = + sample_directory = /etc/postfix sendmail_path = /var/postfix/usr/sbin/sendmail setgid_group = postdrop shlib_directory = no smtpd_banner = $myhostname ESMTP $mail_name smtpd_recipient_restrictions = reject_invalid_hostname,<br> reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, reject_unauth_destination, reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net, reject_rbl_client dnsbl.sorbs.net, reject_rbl_client cbl.abuseat.org, reject_rbl_client b.barracudacentral.org, reject_rbl_client dnsbl-1.uceprotect.net, permit<br> smtpd_sasl_auth_enable = yes smtpd_sasl_path = private/auth smtpd_sasl_type = dovecot smtpd_tls_auth_only = yes smtputf8_enable = no unknown_local_recipient_reject_code = 550 virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias- maps.cf,mysql:/etc/postfix/mysql-email2email.cf virtual_gid_maps = static:5000 virtual_mailbox_base = /var/vmail virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf virtual_mailbox_limit = 51200000 virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf virtual_transport = virtual virtual_uid_maps = static:5000 master.cf relay unix - - n - - smtp flush unix n - n 1000? 0 flush trace unix - - n - 0 bounce verify unix - - n - 1 verify rewrite unix - - - - - trivial-rewrite proxymap unix - - n - - proxymap anvil unix - - n - 1 anvil scache unix - - n - 1 scache discard unix - - n - - discard tlsmgr unix - - n 1000? 1 tlsmgr retry unix - - n - - error proxywrite unix - - n - 1 proxymap smtp unix - - n - - smtp smtp inet n - n - 1 postscreen smtpd pass - - n - - smtpd lmtp unix - - n - - lmtp cleanup unix n - n - 0 cleanup qmgr fifo n - n 300 1 qmgr virtual unix - n n - - virtual dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/local/libexec/dovecot /dovecot-lda -f ${sender} -d ${recipient} mysql-virtual-mailbox-domains.cf user=postfix password=yourpassword host=127.0.0.1 dbname=postfix query=select name from virtual_domains where name='%s' mysql-virtual-mailbox-maps.cf user=postfix password=yourpassword dbname=postfix query=select maildir from virtual_users where email='%s' mysql-virtual-alias-maps.cf user=postfix password=yourpassword host=127.0.0.1 dbname=postfix query=select destination from virtual_aliases where source='%s' The next step is to configure the Dovecot. 10-auth.conf disable_plaintext_auth = yes auth_mechanisms = plain login !include auth-sql.conf.ext comments out all other !include auth-sql.conf.ext passdb { driver = sql args = /etc/dovecot/dovecot-sql.conf.ext } userdb { driver = static args = uid=vmail gid=vmail home=/var/vmail/%d/%n } 10-mail.conf comments out all mail_location Here we use Maildir format to store the email in: /var/vmail/domain/user/Maildir/ folder, in virtual_users table, the column maildir should be in the following format 'yourdomain.com/user/Maildir/' If you have not populated the virtual_users.maildir column correctly, the postfix will use mailbox format, which store all mail belong to a domain to a file /var/vmail/1.
SQLite CGI Programming (SQLITE_CANTOPEN)
When I am trying to use sqlite3_exec to insert new data into the database, it returns error 14 (SQLITE_CANTOPEN). But when I am using sqlite3_prepare_v2 to select, it works fine. Is there an issue with permissions? How to fix it? sprintf(temp, "INSERT INTO owned (pid, oname, okey, ohp, oatt, odef) VALUES (%d, %c%s%c, %c%s%c, %d, %d, %d);", pid, 34, poname, 34, 34, passkey, 34, sqlite3_column_int(res3,0), sqlite3_column_int(res3,1), sqlite3_column_int(res3,2)); error = sqlite3_exec(conn, temp, 0, 0, 0);